Getting a CellRange

Posted by: arturgomes on 27 September 2017, 9:14 pm EST

  • Posted 27 September 2017, 9:14 pm EST

    Hi everyone.

    Maybe I'm too dumb, but I'm not getting a way to select a range of cells in a C1Excel sheet, in order to apply a specific style.
    I've only found (and used before) the MergedCells collection, but I'm pretty sure that it doesn't allow me to just apply a style and, instead, will merge the contents of the affected cells.

    Can anyone give a little tip?

    Thanks in advance.

  • Marked as Answer

    Replied 27 September 2017, 9:14 pm EST


    As I thought, it was very easy. Sorry to bother the community with this simple task.
    For future reference, if anyone has this very same issue, you can use the SelectedCells collection, just like this:
    _sheet.SelectedCells.Add(0, _start, 2, 3).Style = stl

    where _sheet is your XlSheet, _start, in this case, is the column where you want to start the selection and stl is the XLStyle you want to apply.

    Thanks to you all.

    Best regards.

Need extra support?

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

Learn More

Forum Channels