Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Wed Aug 17, 2011 11:51 am


I have some problems to find the Cell count of my worksheet.

I use this lines of code to read the content of an existing XLS file.

Code: Select all
this.workBook = new Spire.Xls.Workbook();

Now i have access to the cell Values but i like to go through all cells line by line so i need the "Rows.Count" and the "Cells.Count".

Code: Select all
for (var i = 1; i < this.workBook.Worksheets[k].Rows.Length; ++i)

The rows count i think is the "Rows.Length" (it's exactly the number of lines i have in my XLS file) but if i use the "Cells.Length"
i get an exception cause the Cells are null.

Code: Select all
for (var j = 0; j < this.workBook.Worksheets[k].Cells.Length; ++j)

How can i solve this problem?


Posts: 1
Joined: Tue Aug 02, 2011 8:59 am

Thu Aug 18, 2011 3:48 am

Hi fbsol,

Thanks for you inquriy.
The property Cells is not supported at present. A new version of Spire.XLS will be release next Monday and the property Cells will be supported.
At present, you could get the number of the cell of a row as:
Code: Select all

and get the special cell as:
Code: Select all
Technical Support / Developer,
e-iceblue Support Team
User avatar

Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Return to Spire.XLS