Xl工作表中的行数 [英] Row count in Xl sheet
问题描述
大家好,
我正在接收流形式的xlsx文件,我需要计算行数.我该怎么办?
I am receiving xlsx file in the form of stream and i need to count the rows . How can i do this?
推荐答案
您好,Giri Abhay,
Hi Giri Abhay,
使用下面提到的代码.
xlWorkSheet.Columns.ClearFormats();
xlWorkSheet.Rows.ClearFormats();
iTotalColumns = xlWorkSheet.UsedRange.Columns.Count;
iTotalRows = xlWorkSheet.UsedRange.Rows.Count;
它将为您提供使用的行数和列数.
it will give you both number of used rows and columns.
如果您在实施此解决方案时遇到任何问题,请让我知道.
if you have any problem to implement this solution please let me know about that.
在这里您没有提到正在开发哪种类型的项目.您已经在VSTO论坛上发布了此问题,并在帖子中谈论了Form.
here you did not mentioned in which type of project you are developing. you had posted this issue in VSTO forum and talking about Form in the post.
如果使用Windows应用程序进行开发,则需要打开文件,创建工作表对象,然后实现上述代码.
if you are developing using Windows Application then you need to open the file , create an object of sheet and then implement the above mentioned code.
致谢
Deepak
这篇关于Xl工作表中的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!