Is there a way to get the rows and columns for cells that has value without having to traverse through the whole worksheet? When I read in Row and Column count, it just gives me what Excel max is for row and column. Thanks.
3 Answers, 1 is accepted
answered on 13 Sep 2013, 10:06 AM
While the Spreadsheet doesn't provide a method that will allow you to get all the cells with values, there is an easy way to vastly narrow down the search for them. The UsedCellRange will give you the cell range of the Worksheet which contains all the used cells. You can see how to get the UsedCellRange in the snippet below.
The CellRange exposes properties like FromIndex and ToIndex that will give you the upper left corner and the bottom right corner indices of the CellRange. You will be able to iterate through the CellRange and find the cells with values different from EmptyCellValue.
I hope this answers your question. If you have any comments or you need any further clarifications, please, let us know.
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely. Sign up for Free application insights >>