210
Spreadsheet control crashes on some spreadsheets
posted

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.

Thanks.

Parents Reply Children
No Data