When I load certain spreadsheets from a hard drive, the spreadsheet control crashes when the code attempts to set the workbook.
If I hover over the workbook variable after this line ...
Infragistics.Documents.Excel.Workbook workbook = Infragistics.Documents.Excel.Workbook.Load(FilePath);
... everything seems fine. The name of the workbook is correct, the number of worksheets, their names, etc. The workbook also opens fine in Excel with no error message.
But as soon as this line executes in my code ...
sprdSource.Workbook = workbook;
.. the control blows up. I get a big red X in the control, and I have to quit the application. This doesn't seem to be an error that we can trap in a try-catch block either. The error from the .NET framework says object reference not set to an instance of an object.
Again, this only happens with some spreadsheets. Some are .xls, some are .xlsx.
Spreadsheet control is 16.1.20161.1000.
In order to test this out, I would like a copy of any xls file you are loading that crashes. Please let me know if you would prefer not to upload this to the public forum and I will create a private case.
A common cause of the red X is use of a control on a background thread. Are you using any threading in your application?
Mike BSoftware Developer
Hi, Mike --
No, there's no threading on the form where it crashes. I'll send you a sample Excel file, but yes, let's make it a private case.
How do I proceed with a private case? Is there something I need to do at my end?
I've created a private case to receive the file. You should see the private case under the Support Activity page on our site. There should be an option to upload the file there.
Please let me know if you have any questions.
Okay, I uploaded in there.