Free Support Forum - aspose.com

Range exception in .save method

I have tried using FileFormatType.SpreadsheetML and FileFormatType.Excel2003 and gotten the same result (with similar stack trace). The code is a new port of code that was working using home grown xml.xmldocument logic.

So the error could be somewhere in the ported logic, but it would be nice to have some clue where to start looking.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at Aspose.Cells.Worksheets.x1f5ad44ad5fea0e9()
at Aspose.Cells.Worksheets.x818789bf932c2ca9()
at Aspose.Cells.Worksheets.xc45aec41e2cb5b99(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x668135b31fe5c8d9(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x806178efa0bb6fcf(FileFormatType xab59d5b558cd3dde)
at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)

The workbook structure is 3 major sheets: rawdata, To and From. The rawdata sheet tends to be 120 columns wide by ~200 (variable) rows. The To and From sheets have the same layout, with many columns hidden and forumlas like "=RawItems!$J10".

I've seen tales of much larger and more complex workbooks in these forums..

Hi,

Could you post your template file and sample codes? We will check it soon.

The attached ZIP file is a fully functional version of the code that runs correctly (without loading a pre-existing file to "update") or incorrectly (when any file is loaded)

Hi,

I tried the following codes , it works fine:

//Instantiate a new Workbook object.
Workbook workbook = new Workbook();

workbook.Open("F:\\FileTemp\\DarnEmptyWBTemplate.xml", FileFormatType.SpreadsheetML);

workbook.Save("F:\\FileTemp\\dest.xls");

About the problem of named range,please see http://www.aspose.com/Community/Forums/thread/102715.aspx

Please try this fix.