We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with AutoFitRows

I ran into the following exception when I called the method below. Since NO row index is passed into the method, it is weird to get an error like this. It appears that in some situation, I can get this error. Unfortunately I cannot make a simple example to demonstrate how this error can occur. I only know that the error appears in the line:

Somehow, it seems that some internal index (not exposed to the user) got out of whack. I would appreciate if you would check your implementation to see how this can happen. In fact it would be even better if you would provide a method that can auto fit all the rows in all the worksheets in a workwork so user does not have implement a method like the one shown below. (i.e., provide an API like: workbook.autoFitRows() )

I am using Aspose.Cells Version VB .Net 3.5.
I am using Excel 2003. I understand that Excel 2003 has different number rows than Excel 2007. Could this be a factor causing the problem?

Error Message:
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.Rows.x6d3720b962bd3112(Int32 xc0c4c459c6ccbd00) at Aspose.Cells.Worksheet.AutoFitRows() at AsposeUtil.CellsUtil.AutoFitRows

This is my method in AsposeUtil.CellsUtil

Public Shared Sub AutoFitRows(ByVal wb As Aspose.Cells.Workbook)
For Each ws As Aspose.Cells.Worksheet In wb.Worksheets
End Sub

Thank you.


Thank you for considering Aspose.

Please try our latest version of Aspose.Cells by downloading from the following location. If you still face any problem, please share your template file and we will check it soon.


Thank You & Best Regards,