Column::SetWidth

Description

Set the display column width of a column in number of characters.

Syntax

BOOL SetWidth( double iWidth = -1 )

Parameters

iWidth
[input] the width in characters (approximate), exact only if the font is fixed width
use -1 to set the width to the largest cell in the column.
use 0 to hide the column

Return

TRUE if set the digitmode successfully, otherwise FALSE.

Examples

EX1

// Set column width of first column in first worksheet in project
void    Column_SetWidth_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wks(wp.GetName());
    int iWidth = 3;
    BOOL b = wks.Columns(0).SetWidth(iWidth);
    out_int("col(1) width set to be very small, ", wks.Columns(0).GetWidth());
    MessageBox(NULL, "Wait...", "Click to expand column width");
    wks.Columns(0).SetWidth();
    out_str("col(1) width set to show all data");
}

Remark

Set the display column width of a column in number of characters.

See Also

Column::GetWidth

header to Include

origin.h