Column::SetTextMaxLen

Description

Set the text width of the column.

Syntax

BOOL SetTextMaxLen( int iTWidth )

Parameters

iTWidth
[input] the text width in characters.

Return

TRUE if set the column width successfully, otherwise FALSE.

Examples

EX1

// Create a worksheet with each column type and try to double their TWidths
void    Column_SetTextMaxLen_Ex1()
{
    Worksheet    wks;
    wks.Create("Origin", CREATE_VISIBLE);
    wks.Columns(0).SetFormat(0); // Same as wks.Columns(0).SetFormat(OKCOLTYPE_NUMERIC)
    wks.Columns(1).SetFormat(1);
    wks.AddCol();
    wks.Columns(2).SetFormat(2);
    wks.AddCol();
    wks.Columns(3).SetFormat(3);
    wks.AddCol();
    wks.Columns(4).SetFormat(4);
    wks.AddCol();
    wks.Columns(5).SetFormat(5);
    wks.AddCol();
    wks.Columns(6).SetFormat(6);
    BOOL bRet;
    for(int ii = 0 ; ii <= 6 ; ii++)
    {
        printf("TWidth is %u, attempting to change to %u\n", wks.Columns(ii).GetTextMaxLen(), 2 * wks.Columns(ii).GetTextMaxLen());
        bRet = wks.Columns(ii).SetTextMaxLen( 2 * wks.Columns(ii).GetTextMaxLen());
        if( bRet )
            printf("New TWidth is %u\n", wks.Columns(ii).GetTextMaxLen());
        else
            printf("Could not change TWidth\n");
    }
}

Remark

Set the text width of a column.

Only the TEXT and TEXT&NUMERIC column types have writable TWidths.

See Also

Column::GetTextMaxLen, Worksheet::GetColDesignations, Worksheet::SetColDesignations

header to Include

origin.h