TrueDBGrid Word Wrapping

Posted by: daniel.banks on 27 February 2019, 10:03 am EST

  • Posted 27 February 2019, 10:03 am EST

    I am struggling to get word wrap working in the cell… using.

    C1.Win.C1TrueDBGrid.TextWrapping.WrapWithOverflow

    On the style property but this seems to only take effect when I edit the cell. As soon as I move to a different column it goes back to single line.

    Is this a bug? Am I doing anything wrong?

    It doesn’t seem to be something that is as difficult as I appear to be having.

    D

  • Posted 28 February 2019, 4:35 am EST

    Hello,

    Please use the following lines of code to achieve the desired result:

    
     public Form2()
            {
                InitializeComponent();
                c1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.IndividualRows;
         
                c1TrueDBGrid1.Style.Wrap = C1.Win.C1TrueDBGrid.TextWrapping.Wrap;
                c1TrueDBGrid1.AfterColUpdate += C1TrueDBGrid1_AfterColUpdate;
              
            }
    
          
    
            private void C1TrueDBGrid1_AfterColUpdate(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)
            {
                c1TrueDBGrid1.Splits[0].Rows[c1TrueDBGrid1.Row].AutoSize();
            }
    
    

    Hope it helps.

    Thanks.

  • Posted 4 March 2019, 6:26 am EST

    Hi,

    I tried this and it didn’t seem to matter… in face the Autosize seems to default to single line no matter what.

    Am I missing something?

    D

  • Posted 4 March 2019, 6:39 am EST

    I notice the wrapping is now working and if I manually change the row height it seems to behave as it should. however the AutoSize on the ColUpdate event always seems to set it back to a single row.

  • Posted 5 March 2019, 5:08 am EST

    Hello,

    I am unable to reproduce the issue at our end with the latest build. Please refer to the attached application.

    Could you please either modify the attached application or provide your own stripped down project so that I can try reproducing the same behavior at my end and assist you further accordingly?

    Thanks.

  • Posted 30 September 2021, 5:49 am EST

    Enabling Wordwrap in Cells

    By default, a grid cell displays a single line of text, truncated at the cell’s right boundary. Display multiple lines of text in a cell by increasing the grid’s RowHeight property and setting the WrapText property of the desired column’s Style object to True. If WrapText is True (the default is False), a line break occurs before words that would otherwise be partially displayed in a cell. The cell contents will continue to display on the next line, assuming that the grid’s row height accommodates multiple lines.

    Use the following loop to enable wordwrap for all grid columns:

    · Visual Basic

    Dim C As C1.Win.C1TrueDBGrid.C1DisplayColumn

    For Each C In Me.C1TrueDBGrid1.Splits(0).DisplayColumns

    C.Style.WrapText = True

    Next

    · C#

    C1.Win.C1trueDBGrid.C1DisplayColumn C ;

    for each(C in this.C1trueDBGrid1.Splits[0].DisplayColumns)

    {

    C.Style.WrapText = true ;

    }

Need extra support?

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

Learn More

Forum Channels