Free Support Forum - aspose.com

Index out of range while opening the worksheet through .NET

When trying to open Excel file using below code exception has been occurred.

Workbook workBook = new Workbook();

workBook.Open(file.FullName);

Exception : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex

I would be very thankful if any one could give solution to this problem.

Regards,

Mark

Hi,

Please try our latest Aspose.Cells for .NET v5.3.2.6 if it works fine.
You may also use the following one line sample code.

Workbook workBook = new Workbook(file.FullName);

If you still find the issue, post your template file here to evaluate your issue.

thank you.

I am getting same exception with Version 7.0.2.0. Following is the exception I got:


Code:
Workbook workbook = new Workbook(sourceFilePath);
workbook.Save(destinationFilePath, Aspose.Cells.SaveFormat.Pdf);

Exception:

2/13/2012 5:49:49 PM
Message: HandlingInstanceID: 2424a8d7-941b-4dc7-8d88-a7f8c31df93e
An exception of type ‘System.ArgumentOutOfRangeException’ occurred and was caught.
2012-02-13 12:49:49Z
System.ArgumentOutOfRangeException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex
mscorlib in file: C:\WINDOWS\TEMP\IntraLinks\266d05ea-2364-421e-aad4-0158af559b20.xls
<undefined value>
startIndex
System.Collections.ListDictionaryInternal
Void ThrowArgumentOutOfRangeException(System.ExceptionArgument, System.ExceptionResource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.BitConverter.ToInt16(Byte[] value, Int32 startIndex)
at ⅏.䆱.䇰()
at ⅏.䆱.䇭(䈞 ա)
at ⅏.䆱.䈎(䈞 ա)
at ⅏.䆱.䈑(MemoryStream ա)
at ⅏.䆱.䈏(৮ ْ)
at Aspose.Cells.Workbook.َ(String ُ, LoadOptions ِ)
at Aspose.Cells.Workbook…ctor(String file)
at Intralinks.Common.Utilities.AsposeConverter.ConvertXlsToPdf(String sourceFilePath, String destinationFilePath) in c:\ilbuilds\pdfconv\build_trunk\CommonUtilities\AsposeConverter.cs:line 78
at Intralinks.Common.Utilities.CommonUtilities.ConvertOfficeDocsToPDF(String sourceFile, String destinationFolder, Boolean useOriginalFileName) in c:\ilbuilds\pdfconv\build_trunk\CommonUtilities\CommonUtilities.cs:line 1439
Category: Logging Exception
Priority: 1
EventId: 100
Severity: Error
Title:Enterprise Library Exception Handling
Machine: WDPDPF01
Application Domain: ILPDFConversionService.exe
Process Id: 7300
Process Name: C:\PDFConvService\WOODDALE.pdfconv\instance1\Release\ILPDFConversionService.exe
Win32 Thread Id: 2528
Thread Name:
Extended Properties: Product Version - 3.1.26568.0

Hi,


Please download and try our latest version/fix: Aspose.Cells for .NET v 7.1.1.1

If you still find the issue, kindly attach your Excel file here, we will check your issue soon.

Thank you.

Hi Manar,


Please attach your template file here. We will check your issue soon.

Thank you.