We are attempting to open a excel workbook exported from a legacy version of crystal reports (which opens fine in Excel 2007), but getting the following error (on instantiating workbook object):
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex
Using the following code:
Dim stream As New System.IO.FileStream(“C:\data\BYM_Client_Export1140908.xls”, IO.FileMode.Open)
Dim loadOptions As New Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Excel97To2003)
Dim wb As New Aspose.Cells.Workbook(stream, loadOptions)
Please can you help to explain why the file cannot be read?
Thanks
Matthew
Hi Matthew,
Thanks for your posting and using Aspose.Cells.
We have looked into your source file namely bym_client_export1140908.xls and opened in MS-Excel 2010 and MS-Excel 2007. Both of them showed error on opening this file. So this file is actually corrupt.
If you will try to open a corrupt file using Aspose.Cells, it will throw the exception as it is throwing in your case.
Please see the screenshot below that displays error in MS-Excel 2010 when your file is opened for your reference.
We have seen the error in Excel 2010, but the file will open successfully in Excel 2007. And we were hoping to use aspose.cells to convert between 2007 (xls) and 2010 (xlsx).
Thanks
Matthew
Hi Matthew,
Thanks for your posting and using Aspose.Cells.
Your file also does not open well in MS-Excel 2007 as I mentioned earlier. However, we have logged an investigation ticket for this issue in our database. We will look into it and fix this issue if possible.
Once, there is some fix or other update for you, we will let you know asap.
This issue has been logged as CELLSNET-42555.
Hi,
Thanks for using Aspose.Cells.
Please download and try this fix: Aspose.Cells
for .NET v8.0.0.3.
We have now ignored some invalid records in the file, but it’s better that you can
find why your tool create such file.