worksheet.Cells.Rows.Count probelm

Hi,

I have a excel file. when i try to count the rows number, its return 1 more than the original one.

I have checked the file several times but there is only 10 rows. but its return 11.

Here is the sample code:

workbook.Open(fstream);

Worksheet worksheet = workbook.Worksheets[0];

int rowCount = worksheet.Cells.Rows.Count ;

Is it possible to count a blank row? Whats the problem?

Plz help me out.

Thanks in advanced

Mamun

Hi Mamun,

Please post your sample file. We will check it soon.

Hi warren, plz find the attachement for wrong count file.

Hi warren, plz find the attachement file for the right count file.

Hi,

Please use Cells.MaxDataRow - Cells.MinRow + 1 to get the row count.

It doesnt work for me....for both file it returns same row count which is not correct....

Is there any other way?

Hi,

Do you means that you want to ignore all blank rows ? Now we have no according method to get such row count.

Please explain your need. We will check if we have another solution to serve your need.