Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Headers / Wrapping the Header Text
In This Topic
    Wrapping the Header Text
    In This Topic

    In Spread, you can customize text wrap in a column header by setting the WrapText property of IRange Interface to true. Note that to view the wrapped text properly in the cell, you need to adjust the row height using the RowHeight property in the ColumnHeader class.

    Before applying this WrapText property, ensure that the value of ColumnHeaderRenderer.WordWrap2 property of the SpreadSkin class is set to null. If not, Spread uses the specified value of the  ColumnHeaderRenderer property as the default renderer to paint cells in the ColumnHeader area. By default, the ColumnHeaderRenderer.WordWrap2 value is null for the Default skin only.

    The following image depicts a preview of the wrapped text in the column header.

     

    Use the sample codes below to wrap the column header text using the IRange.WrapText property.

    C#
    Copy Code
    // Wrap text in column header
    activeSheet.ColumnHeader.Cells.RowHeight = 90;
    activeSheet.ColumnHeader.Cells[0, 0].Value = "This is a long header text";
    activeSheet.ColumnHeader.Cells[0, 0].WrapText = true;
    
    VB
    Copy Code
    ' Wrap text in column header
    activeSheet.ColumnHeader.Cells.RowHeight = 90
    activeSheet.ColumnHeader.Cells(0, 0).Value = "This is a long header text"
    activeSheet.ColumnHeader.Cells(0, 0).WrapText = True