Counting rows porblem

Attached you would find 2 Excel files. Both looks same and contains the same data.

When I count the number of rows present in each file by using Cells.MaxDataRow property, this is what I get.

File Row9.xls returns 9 rows
File Row2.xls returns 2 rows

I know there is some sort of hidden formatting or something in Row9.xls file which makes the count 9 instead of 2 , my question is how can I detect such kind of behaviour. Is there a way in Aspose to re-format or something like this which could give me the right number of rows.

Thanks.

Abdul Ahad

Hi Abdul Ahad,

Thanks for considering Aspose.

Well, I tested your file Row9.xls, Cells.MaxDataRow give me 2 value which is fine as I checked your template file.

Following is my code:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\singfiles\\Files\\Row9.xls");
Cells cells = workbook.Worksheets[0].Cells;
int lastrowindex = cells.MaxDataRowInColumn(0);
MessageBox.Show(lastrowindex.ToString()); //Return 2.
And I don't find any hidden formattings in that file. Cells.MaxDataRow give you the farthest row index no. which contains data only. And Cells.MaxRow give you the row index which contains data or formattings.
Thank you.