Spreadsheet row and column

3 posts, 0 answers
  1. Mattheu
    Mattheu avatar
    2 posts
    Member since:
    Jun 2012

    Posted 12 Sep 2013 Link to this post

    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.
  2. Anna
    Anna avatar
    99 posts

    Posted 13 Sep 2013 Link to this post

    Hi Mattheu,

    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.
    CellRange usedCellRange = this.radSpreadsheet.ActiveWorksheet.UsedCellRange;

    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.

    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 >>
  3. DevCraft R3 2016 release webinar banner
  4. Mattheu
    Mattheu avatar
    2 posts
    Member since:
    Jun 2012

    Posted 07 Nov 2013 Link to this post

    excellent. Exactly what I was looking needing.
Back to Top