We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Excel Engine failed to load workbook

I am opening and validation workbooks through an ASP.Net page that is called from a Silverlight application.  I am trying to open a workbook via a stream in C# code behind on the page and the error I get is:

"Destination array is not long enough to copy all the items in the collection. Check array index and length."

The code is C# and the stream is a System.IO.Stream:

            ExcelEngine EE = new ExcelEngine();
            
            IWorkbook ValWorkbook = EE.Excel.Workbooks.Open(CRStream, ExcelOpenType.Automatic);

The file size is 1.1MB and it is a Excel 2007 workbook.  The stack returned from the try/catch is:

   at System.BitConverter.ToInt16(Byte[] value, Int32 startIndex)
   at Syncfusion.XlsIO.Parser.Biff_Records.ByteArrayDataProvider.ReadInt16(Int32 iOffset)
   at Syncfusion.XlsIO.Implementation.Collections.RowStorage.SetFormulaValue(Int32 iColumn, Double value, StringRecord strRecord, Int32 iBlockSize)
   at Syncfusion.XlsIO.Implementation.Collections.RecordTable.SetFormulaValue(Int32 iRow, Int32 iColumn, Double value, StringRecord strRecord)
   at Syncfusion.XlsIO.Implementation.WorksheetImpl.SetFormulaValue(Int32 iRow, Int32 iColumn, Double value, StringRecord strRecord)
   at Syncfusion.XlsIO.Implementation.WorksheetImpl.SetFormulaValue(Int32 iRow, Int32 iColumn, Double value)
   at Syncfusion.XlsIO.Implementation.WorksheetImpl.SetFormulaNumberValue(Int32 iRow, Int32 iColumn, Double value)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.SetFormulaValue(IInternalWorksheet sheet, CellType cellType, String strValue, Int32 iRowIndex, Int32 iColumnIndex)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseCell(XmlReader reader, IInternalWorksheet sheet, List`1 arrStyles, Int32 rowIndex, Int32 columnIndex)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseRow(XmlReader reader, IInternalWorksheet sheet, List`1 arrStyles, String cellTag, Int32 generatedRowIndex)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseSheetData(XmlReader reader, IInternalWorksheet sheet, List`1 arrStyles, String cellTag)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseSheet(XmlReader reader, WorksheetImpl sheet, String strParentPath, MemoryStream& streamStart, MemoryStream& streamCF, List`1 arrStyles, Dictionary`2 dictItemsToRemove, Dictionary`2 dictUpdatedSSTIndexes)
   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseWorksheetData(WorksheetImpl sheet, Dictionary`2 dictUpdateSSTIndexes)
   at Syncfusion.XlsIO.Implementation.WorksheetImpl.ParseData(Dictionary`2 dictUpdatedSSTIndexes)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseWorksheets(Dictionary`2 dictUpdatedSSTIndexes)
   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseWorkbook(List`1& themeColors)
   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseDocument(List`1& themeColors)
   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseExcel2007Stream(Stream stream, String password)
   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, ExcelVersion version)
   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType)
   at MSLC_IMCARS.Web.upload.ValidateCostReport(Stream CRStream, String CRFileName) in C:\IMCARS5\Development\MSLC_IMCARS_Apps\MSLC_IMCARS.Web\FileUploader.aspx.cs:line 408
   at MSLC_IMCARS.Web.upload.UploadButton_Click(Object sender, EventArgs e) in C:\IMCARS5\Development\MSLC_IMCARS_Apps\MSLC_IMCARS.Web\FileUploader.aspx.cs:line 99

This has been working for smaller workbooks.  Seems to choke at the System.BitConverter.  Is there a way to adjust the destination array?  Is this a setup I have to do when creating the Engine?  Is there a file size limitation?  Due to HIPAA regulations, I can't send the workbook.

Thank you.


1 Reply

IN Ishwarya Narayanan Syncfusion Team September 15, 2014 11:43 AM UTC

Hi David,

 

We have tried in different scenarios and are unable to reproduce the issue. We suspect that the issue raises while applying certain formula. Kindly share us the simplified issue reproducing sample or the input template which helps us to investigate further on this.

 

We would request you to use our Direct-Trac Support system for further follow up.

 

Please let us know if you need any clarification.

 

Regards,

Ishwarya N


Loader.
Live Chat Icon For mobile
Up arrow icon