Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Use of custom Table style

$
0
0
I have a workbook with an existing custom table style. The first issue I ran into is that ClosedXML throws an error when opening an existing workbook where a table uses a custom style. The error is: "Requested value 'StyleName' was not found." and trace:
   at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at System.Enum.Parse(Type enumType, String value)
   at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument  
As I didn't need to have preexisting tables this was okay. However I can't figure out how to apply my custom theme to a new table.

I suspect that it is currently a limitation, and that the error is related. I believe the code is trying to parse the table Style name and find it within the XLTableTheme Enum.

Is this a current limitation? Is there a workaround for this issue? If there is no plan to support custom table styles directly, is it perhaps possible to catch a Parse error on the table style enum and use a 'default' table style - to allow existing workbooks with custom styles to be opened?

Thanks and kind regards,

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>