Hi,
I have encountered an issue when trying to dynamically Create (or) Insert worksheets with names that contain special characters like (:, , /, ?, , [ or ],(!{ ) and names with more than 31 characters.
There is no specific exception or error message in the aspose cell that addresses the issue with the sheet name.
Example:
Workbook TestBook ;
TestBook.Worksheets.Add(@“Special\Char/?”);
The excel sheet by default does not allow the creation of worksheet with the name that contains the above listed illegal characters and length.Currently I have created a regular expression to check and replace the illegal characters.
Example:
Workbook TestBook ;
string TestSheetName = @“Special\Char/?”;
TestSheetName = TestSheetName.Length > 31 ? TestSheetName.Remove(31) : TestSheetName;
TestSheetName = Regex.Replace(TestSheetName, @"([\!?:[/]])", “_”);
TestBook.Worksheets.Add(TestSheetName);
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>
<![endif]–><span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”;”>Feature Request :
So it would be better to address the above validation and exceptions for the sheetname in the aspose cell.
Regards,
Dimitri