FlexGrid for WinForms | ComponentOne
Merge / Handle Spilling Text
In This Topic
    Handle Spilling Text
    In This Topic

    In FlexGrid, you can create the same behavior as excel for handling long text entries by spilling them into empty adjacent cells. This behavior not only helps you in handling long text entries of usual cells but also in displaying outline nodes which are different from data rows. This topic discusses these two scenarios in the following sections. These settings work on the grid level and does not need you to set AllowMerging property of specific row or column.

    Handle Spill in Normal Cells

    This FlexGrid setting causes text that is too long to fit in a cell to spill into empty adjacent cells. If you have a long entry in a cell and the adjacent cell is empty, the entry spills onto the adjacent cells to occupy as much room as needed. This behavior can be achieved by setting the AllowMerging property to Spill. For instance, in the image below, long data strings from TestGroup column cells spill to the empty Flag column cells, giving a better visibility of data while using the available space on the grid. 

    Handle spill in normal cells

    Following code enables spilling of long text to adjacent empty cell in the WinForms FlexGrid.

    // Spill the long text to adjacent empty cells
    c1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Spill;
    
    ' Spill the long text to adjacent empty cells
    c1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Spill
    

    Handle Text in Node Rows

    The Nodes setting is similar to Spill but only applies to outline nodes. This setting is useful when data is organized into groups, and the node rows contain information in a format different from the data rows. For this, you must set the C1FlexGrid.AllowMerging property to Nodes.

    handle spill in fixed cells

    Following code shows how to handle long text in node rows of the WinForms FlexGrid.

     // Spill the long text in node rows to adjacent empty cells 
     c1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Nodes; 
    
    ' Spill the long text in node rows to adjacent empty cells 
    c1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Nodes