Hi,
while working with the Infragistics Excel Engine in ASP.NET, especially with styles, I stumbled upon an exception "Unable to cast object of type 'Infragistics.Documents.Excel.WorkbookUserDefinedStyle' to type [...]". Besides the facts that I made a mistake in my code and that a user defined style can be cast as a WorkbookStyle like here:
WorkbookStyle style = (WorkbookStyle)workBook.Styles["StyleName"];
I have two questions:
Just because I'm curious...
WorkbookUserDefinedStyle is an internal type. The error message you are seeing is likely a bug in the Excel library. I have forwarded this post to the Developer Support Manager and a DS engineer will be contacting you about this issue.
With regard to your questions, the WorkbookUserDefinedStyle is not exposed because it does not provide any useful functionality beyond that of WorkbookStyle (its base class). It is simple used to store a custom name, which a built-in style does not need to store, and which is accessible via the WorkbookStyle.Name property.
Hello bernhardus,
Is it possible for you to share the stack trace of the exception you are getting that will help us to dig in to this issue more promptly?
Thank you in advance.