Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Aug 17, 2011 11:51 am

Hello,

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();
this.workBook.LoadFromFile(path);


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?

Thanks
fbsol

fbsol
 
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
sheet.Rows[0].ColumnCount

and get the special cell as:
Code: Select all
sheet.Rows[0].Columns[i]
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

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

Return to Spire.XLS