SetTextMaxLen
Set the text width of the column.
BOOL SetTextMaxLen( int iTWidth )
TRUE if set the column width successfully, otherwise FALSE.
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"); } }
Set the text width of a column.
Only the TEXT and TEXT&NUMERIC column types have writable TWidths.
Column::GetTextMaxLen, Worksheet::GetColDesignations, Worksheet::SetColDesignations
origin.h