How to get total rows of a table

Hi everyone,


I’m new in Aspose Cells and I was trying to export a table placed in a sheet. Using the ExportDataTableAsString works fine if I know how many lines I need to read. But in one of my cases the table could have 10 rows or 1000 rows.

There is a way I can know how many lines I’m supossed to read for that sheet?

Regards,

Alfredo

Hi,


Well, you may try to use Cells.MaxDataRow and Cells.MaxDataColumn to get the farthest row/column indexes, so you could specify the number of rows and columns accordingly for your needs.
e.g
Sample code:

DataTable dataTable = worksheet.Cells.ExportDataTableAsString(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxColumn + 1);

Hope, this helps a bit.

Thank you.


Thanks Amjad, that’s what I needed.


Regards,

Alfredo

Hi Alfredo,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the MaxDataRow and MaxDataColum properties. Let us know if you encounter any other issue, we will be glad to look into it and help you further.