Free Support Forum - aspose.com

How to get last row with data

Hi,


I am using Aspose 7.3.2.4. Our excel template has many rows which user fills up as part of process and upload it. We dont know how many rows user have filled up. We know start row to iterate but don’t know till how many rows we have to go to find data. How do i get that in Aspose Cell. Java

In some of the forum i read to use Worksheet.Cells.MaxDataRow. However my eclipse is not able to find it

Workbook wb = new Workbook();

wb.Open(“d:\test\tstbk1.xls”);

Worksheet ws = wb.Worksheets[0];

int maxDataRow = ws.Cells.MaxDataRow //when i type ws.Cells, it doesn’t come.


Is this deprecated or there is other way to get it?


thanks

chintan

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please type ws.getCells().getMaxDataRow(). It should show in Eclipse. You were using .NET code. I have translated it into Java code for your needs.

Java



Workbook wb = new Workbook(filePath);

Worksheet ws = wb.getWorksheets().get(0);

int maxDataRow = ws.getCells().getMaxDataRow();

Thank you very much for the help!

Hi,


Good to know that your issue is resolved. If you face any other issue, please feel free to post on our forums, we will be glad to assist you further.

Thank you.