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

Free Support Forum - aspose.com

Problem using getRowByIndex()

Hi,

I try to retrieve a row, using getRowByIndex() method.
But the result is very strange :sometimes Aspose find the row and sometimes no.
I join a source and an excel file to test it (problem to retrieve row for cell = “A199”).

Thanks

Hi Joelle,

Thank you for the sample.

We have evaluated the presented scenario while using the latest revision of Aspose.Cells for Java 8.6.3.2 and we are able to notice the said issue. In order to further investigate the matter, we have logged this incident as CELLSJAVA-41668. Please spare us some time for analysis. In the meanwhile, we will keep you posted with updates in this regard.

That said, we advise you to use RowCollection.get(int index) method that behaves in a similar fashion, that is; it takes the index as parameter and returns an instance of Row.

Hi,

Thanks for using Aspose.Cells.

a) The param “index” of the method RowCollection.getRowByIndex(int index) is the position of the row object in the RowCollection(Rows list), not the Row index displayed in MS Excel.

This method RowCollection.getRowByIndex(int index) is used to quickly iterate all Row objects in the worksheet, it should be used as the following:

Java

for (int i = 0; i < cellsCollection.getRows().getCount(); i++) {
rowToModifie = cellsCollection.getRows().getRowByIndex(i);
}

And you can use RowCollection.iterator() method to iterate all Row objects too.

b) If you want to get desired Row object with Row index (such as 199 in the Cell “A199”), please use RowCollection.Get(int RowIndex) method.