简体   繁体   中英

How to get the Row count for only Specified Range of columns in WorkSheet using ClosedXMl

I have a worksheet and one column of work sheet has more number of rows and remaining columns has different number of rows. I had a requirement like need to get the rowcount of those columns only not the irrelevant column. I had used the below code to get the rowcount but it is Counting by adding the rows in columns with the rows in irrelevant column.

For Example if I use the below code for the For the worksheet shown in image I am getting 6 but I need to get the 3.

int RowCount = workSheet.Rows().Count();

See the below image:

在此处输入图片说明

要获取指定行数,我们可以使用以下代码

int RowCount = workSheet.Range("A2:k2").RowsUsed().Count(); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM