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

Error when uploading xlsx file instead of xls

Hello,
 
I am getting following error while uploading xlsx file instead of xls
Specified argument was out of the range of valid values. at Syncfusion.XlsIO.Implementation.RangeImpl.CheckRange(Int32 row, Int32 column) at Syncfusion.XlsIO.Implementation.RangeImpl.get_Item(Int32 row, Int32 column, Int32 lastRow, Int32 lastColumn) at Syncfusion.XlsIO.Implementation.HPageBreakImpl.get_Location() at Syncfusion.XlsIO.Implementation.Collections.HPageBreaksCollection.Add(HPageBreakImpl pageBreak) at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseHorizontalPagebreaks(XmlReader reader, WorksheetImpl sheet) at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseAfterSheetData(XmlReader reader, WorksheetImpl sheet, MemoryStream& streamCF, String strParentPath, Dictionary`2 dictItemsToRemove) 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, ExcelOpenType openType, String fileName, ExcelVersion version, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String fileName, ExcelOpenType openType, ExcelVersion version, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String fileName, ExcelOpenType openType, ExcelVersion version) at AuditdspUpload.ProcessAudit(Object UFile) at AuditdspUpload.DoUpload(Object Sender, EventArgs e)
I am using below code
 

If UCase(Right(sPath, 5)) = ".XLSX" Or UCase(Right(sPath, 5)) = ".XLSM" Then

excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2007

Else

excelEngine.Excel.DefaultVersion = ExcelVersion.Excel97to2003

End If

workbook = excelEngine.Excel.Workbooks.Open(sPath, ExcelOpenType.Automatic, ExcelVersion.Excel2007)

 

Can you please look at it and help me out?

 

Thanks,

Prakash


5 Replies

PK Prakash Kumar D Syncfusion Team March 5, 2014 06:55 AM UTC

Hi Prakash,

We have analyzed your query. “ArgumentOutOfRangeException” raises only if row index is less than 0 or greater than 1048576 (65535 for *.xls) or column index is less than 0 or greater than 16384 (256 for *.xls). Please cross check the HPageBreak row and column index from your side.  If the issue still exists, kindly create an incident from the following link.

Incident Link:

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Thanks,
Prakash.



PM Prakash Makhija March 7, 2014 08:27 AM UTC

Hello Prakash,
 
The functionality works fine when i upload xls template but when i convert the same template into .xlsx i get below issue and i am getting the issue on open method 

workbook = excelEngine.Excel.Workbooks.Open(sPath, ExcelOpenType.Automatic, ExcelVersion.Excel2007)

Thanks,

Prakash Makhija



PK Prakash Kumar D Syncfusion Team March 10, 2014 08:35 AM UTC

Hi Prakash,

We have analyzed the issue and are unable to reproduce the exception it at our end. We have provided a simplified sample that we tried to reproduce for your reference. Kindly try the sample at your end and get back to us if the issue is reproducing. If not, please provide us a simplified issue reproducing sample to investigate further on this and get back to you with a prompt solution.

Regards,
Prakash


Attachment: Pagebreaks_44d70e1b.zip


DB David Ballard September 12, 2014 07:27 PM UTC

I am also having this exact problem.  I have traced this back to XLS (excel 2003) workbook saved as an XLSX (excel 2007) workbook.  The XLS workbook is opened by the excel engine with no problems.

When the XLS workbook is saved as a XLSX workbook in MS Excel, the syncfusion excel engine will not open the workbook and gives an error about the destination array is not large enough.  Whatever the error is, the converted workbook chokes the syncfusion excel engine.

My code runs both in client side Silverlight and server side ASP web page code behind.  Same results for a converted workbook.

Is there something in the sheets that the engine doesn't like when an up-conversion from XLS to XLSX is done?

Thanks.



DB Dilli Babu Nandha Gopal Syncfusion Team September 15, 2014 01:09 PM UTC

Hi David,

 We have tried in different scenarios and are unable to reproduce the issue. We suspect that the issue raises while copying a larger array into a smaller array. 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,

Dilli babu


Loader.
Live Chat Icon For mobile
Up arrow icon