This is a migrated thread and some comments may be shown as answers.

Empty cells & rows

2 Answers 879 Views
SpreadProcessing
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 13 Oct 2015, 11:30 AM

I've used the example show in de docs to import a csv file into a worksheet:

http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadprocessing/formats-and-conversion/csv/csvformatprovider

After importing the file, the worksheet is filled with the proper data. However, the Columns.Count and Rows.Count properties are set on the maximum they can be, not the number of imported rows and columns. 

What is the fast way to find out which rows and columns are empty? I want to stop processing the document as soon as I've reached the first empty row.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Anna
Telerik team
answered on 14 Oct 2015, 08:09 AM
Hello Mark,

These properties indeed return the total rows/columns count of the worksheet, regardless of whether they are empty or not. In your case I would suggest using the UsedCellRange property of the worksheet. The ToIndex property of the used cell range should tell you where the last non-empty cell is, that is, the row and column it belongs to.

I hope this suggestion will be helpful.

Regards,
Anna
Telerik
0
Mark
Top achievements
Rank 1
answered on 14 Oct 2015, 01:51 PM
Thank you, that was the property I was looking for
Tags
SpreadProcessing
Asked by
Mark
Top achievements
Rank 1
Answers by
Anna
Telerik team
Mark
Top achievements
Rank 1
Share this question
or