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.