Named Ranges in Excel OpenXML -


I am trying to create named ranges in Excel with OpenXML. I'm able to add a defined name to the DefinedNames collection, but nothing looks like I have seen one of the extended file proprietes where the names of the categories are being saved, the structure named "titsoffproves". I have tried to add an entry there but it causes Excel to throw error and the designated category is not created. Here's the code I'm using:

  Public Zero AddNamedRange (string pNamedRangeRef, string pNamedRangeName) {DefinedName _definedName = new DefinedName () {name = pNamedRangeName, text = pNamedRangeRef}; _workbook.Descendants & LT; DocumentFormat.OpenXml.Spreadsheet.DefinedNames & gt; () First () Attached (_definedName). DocumentFormat.OpenXml.VariantTypes.VTLPSTR _t = New DocumentFormat.OpenXml.VariantTypes.VTLPSTR () {text = pNamedRangeName}; _spreadsheet.ExtendedFilePropertiesPart.Properties.TitlesOfParts.VTVector.Append (_t); _spreadsheet.ExtendedFilePropertiesPart.Properties.TitlesOfParts.VTVector.Size ++; Using  Open XML SDK 2.0 Productivity Tool for Microsoft Office  Code>, a global / workbook-wide named category is very easy to define:  
  defined define names Name names = New DefinedNames (); // Create a Definition DefinedName Defined Name = New Defined Name () {Name = "Test", Text = "Sheet1! $ B $ 2: $ B $ 4"}; // Define a new category defined by NameCol.Append (definedName); // Add to the archive workbook. Append (definedNamesCol); // Add collection to workbook    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -