CellRange and GetSelections

Posted by: r3dh2t on 8 September 2017, 1:47 pm EST

  • Posted 8 September 2017, 1:47 pm EST

    <p>Greetings,  </p><p>I currently am experimenting with GetSelection and CellRanges in C#.  I want to be able to take the CellRange object, and be able to do some sort of foreach loop through it.  Is this possible?  Currently the only way I can loop through to get each individual cell is this:</p><p> </p><p>FarPoint.Win.Spread.Model.CellRange[] cr;<br>            cr = spdSht.Sheets[0].GetSelections();<br>            for (int i = 0; i < cr.Count(); i++)<br>                for (int j = cr[ i].Row; j < cr[ i].Row + cr[ i].RowCount; j++)<br>                    for (int k = cr[ i].Column; k < cr[ i].Column + cr[ i].ColumnCount; k++)<br>                        DoSomethingOn(spdSht.Sheets[0].Cells[j, k]);<br></p><p>It seems like my solution is clunky.  I am hoping there is some sort of better way.  E.g. a Cellrange returns a collection of cells I can foreach loop through.   Any guidance would be greatly appreciated!</p><p> Thanks,</p><p>- b <br></p>
  • Replied 8 September 2017, 1:47 pm EST

    <P>There is not any enumerators on the CellRange object. So the code you have is the only way to get all the cells.</P>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels