Hi,
I'm trying to use Infragistics3.Excel.v10.1 (10.1.20101.2018) to load an excel 2010 spreadsheet, but I keep getting an ArgumentOutOfRange exception:
"Index was out of range. It must be non-negative and less than the size of the collection. Parameter name: index Actual value was 0."
This is in a winforms VB.Net 2010 project, using .Net 4.0. As I understand it, the XLSX format is the same for 2007 and 2010, so shouldn't this work? I get the error with any XLSX file.
The stack trace of the exception is included below,
Kev
Stack Trace
at Infragistics.Excel.WorksheetCollection.get_Item(Int32 index) at Infragistics.Excel.Workbook.OnAfterLoadGlobalSettings(WorkbookSerializationManager manager) at Infragistics.Excel.Serialization.Excel2007.XLSX.Elements.WorkbookElement.OnAfterLoadChildElements(Excel2007WorkbookSerializationManager manager, ElementDataCache elementCache) at Infragistics.Excel.Serialization.Excel2007.XmlElementBase.LoadChildElements(Excel2007WorkbookSerializationManager manager, ExcelXmlNode node, ExcelXmlDocument document, XmlReader reader, ElementDataCache elementCache, List`1 elementCacheCollection, BeforeLoadElementCallback beforeLoadElementHandler, AfterLoadElementCallback afterLoadElementHandler, Boolean& isReaderOnNextNode) at Infragistics.Excel.Serialization.Excel2007.XmlElementBase.LoadChildElements(Excel2007WorkbookSerializationManager manager, ExcelXmlNode node, BeforeLoadElementCallback beforeLoadElementHandler, AfterLoadElementCallback afterLoadElementHandler, Boolean& isReaderOnNextNode) at Infragistics.Excel.Serialization.Excel2007.XmlElementBase.LoadChildElements(Excel2007WorkbookSerializationManager manager, ExcelXmlNode node, Boolean& isReaderOnNextNode) at Infragistics.Excel.Serialization.Excel2007.XmlContentTypeBase.Load(Excel2007WorkbookSerializationManager manager, Stream contentTypeStream) at Infragistics.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPart(IPackagePart part) at Infragistics.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType) at Infragistics.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadWorkbookContents() at Infragistics.Excel.Serialization.WorkbookSerializationManager.Load() at Infragistics.Excel.Workbook.LoadXLSXFile(Workbook workbook, Stream stream, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Excel.Workbook.LoadHelper(Stream stream, WorkbookFormat format, String parameterName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Excel.Workbook.Load(String fileName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Excel.Workbook.Load(String fileName, IPackageFactory packageFactory) at Infragistics.Excel.Workbook.Load(String fileName)
Were you able to reproduce the error Matteo? What about if you ran the compiled executable straight from the zip file?
Hi Matteo,
I've attached a small project that illustrates the error, and a sample spreadsheet
Kevin
Hello Kevin,
Can you try to use this code instead than the method "Load" and tell me if it works for you?
Dim wb As Workbook
Dim ws As Worksheet
wb =
New Workbook()
ws = wb.Worksheets.Add(
"aldebaran 132wb.xls")
'wb = Infragistics.Excel.Workbook.Load("aldebaran 132wb.xls")
Sincerely,MatteoDeveloper Support EngineerInfragisticswww.infragistics.com/support
Hello Kavin,
I tried to reproduce the issue you are describing using VB and C# (Visual Studio 2008 and 2010), and Infragistics3.Excel.v10.1 and Office 2010, but I didn't get any exception, could you send me the actual spreadsheet you used?
Thanks - I was starting to think I was doing something stupid!