Exception on opening the excel file with XlsIO

Hey!

I am trying to convert a .xlsb file to PDF but I am facing an exception on this line:

IWorkbook sfworkbook = application.Workbooks.Open(fileStream, ExcelParseOptions.ParseWorksheetsOnDemand);


The exception is as follows:

Message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

StackTrace:    at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException()

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseCells(Stream stream, WorksheetImpl sheet, Int32 rowIndex, List`1 xFIndexes)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseRows(Stream stream, WorksheetImpl sheet, List`1 arrStyles)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseSheetData(Stream stream, WorksheetImpl sheet, List`1 xFIndexes)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseSheet(Stream stream, WorksheetImpl sheet, String strParentPath, List`1 xFIndexes, Dictionary`2 itemsToRemove, Dictionary`2 dictUpdateSSTIndexes)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseBinaryWorksheetData(WorksheetImpl sheet, Dictionary`2 dictUpdateSSTIndexes, Boolean parseOnDemand, XlsbDataHolder dataHolder)

   at Syncfusion.XlsIO.Implementation.WorksheetImpl.ParseBinaryData(Dictionary`2 dictUpdatedSSTIndexes, XlsbDataHolder holder)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseWorksheets(Dictionary`2 dictUpdatedSSTIndexes)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseWorkbook(List`1 themeColors)

   at Syncfusion.XlsIO.Implementation.Xlsb.XlsbDataHolder.ParseDocument(List`1& themeColors, Stream stream)

   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseExcel2007Stream(Stream stream, String password, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseStream(Stream stream, String password, ExcelVersion version, ExcelParseOptions options)

   at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, Stream stream, ExcelParseOptions options, ExcelVersion version)

   at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, Stream stream, ExcelVersion version, ExcelParseOptions options)

   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelVersion version, ExcelParseOptions options)

   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType, ExcelParseOptions options)

   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelParseOptions options)



3 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 11, 2021 10:58 AM UTC

Hi Ahmad, 

Greetings from Syncfusion. 

We request you to share the Excel document you are using at your end, which will be helpful for us in investigating the query and provide prompt solution at the earliest. 

Regards, 
Keerthi.


AH Ahmad January 15, 2021 09:20 AM UTC

Hey Keerthi!

Thanks for the prompt response. Please find attached the excel file we are trying to convert.

Appreciate your urgent response.

Thanks & Regards

Attachment: 784C7A13F70DEB11A813000D3AB55801_ae51a16fd2dbea11a8130022489d8bbc_8e072176494beb11a812000d3ada6b1f_67fe3f65.zip


SK Shamini Kiruba Sobers Syncfusion Team January 18, 2021 12:45 PM UTC

Hi Ahmad, 
 
Thanks for sharing the file. But we are unable to reproduce the reported issue with the shared code and the file in our latest version. We could also notice that you have mentioned that you are using an XLSB file and the shared file is an XLSX file. So please check whether you have shared the issue reproducing file. 
 
The sample we tried at our end to reproduce the reported issue can be downloaded from the following link. 
 
Kindly modify the sample to replicate the issue and send back to us for further investigation. Also, please mention the Syncfusion XlsIO version that you are using at your end. 
 
Regards, 
Shamini 


Loader.
Up arrow icon