How can I tell if a cell in a grid is merged?

Posted by: arcady on 16 February 2022, 11:23 pm EST

  • Posted 16 February 2022, 11:23 pm EST

    Hello, all

    In the activeX component there was a property mergecell, which told the user if the cell is merged. How can I tell the same thing in WinForms?

    Thank you,

    Arcady Abramov

  • Posted 17 February 2022, 5:56 pm EST

    Hi,

    You can use the GetMergedRange method of the C1FlexGrid to get the merged range containing the required cell. Then you can check if the cell is merged or not by using the IsSingleCell property of the CellRange returned by the method. If the IsSingleCell property is true, then the cell is not merged, else the cell is merged. Kindly refer to the code snippet below in which we have created a method to check if a cell is merged or not.

    private bool IsCellMerged(int row, int col)
    {
        C1.Win.C1FlexGrid.CellRange cr = c1FlexGrid1.GetMergedRange(row, col);
        return !cr.IsSingleCell;
    }
    

    Regards.

  • Posted 19 February 2022, 3:30 pm EST

    Thank you,

    We shall try that

Need extra support?

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

Learn More

Forum Channels