Example
The following example determines the maximum width of a cell using the MaxTextCellWidth property and assigns this value as the column width using the ColWidth property.
C++
// Size col width to fill max length of the text in the cell
m_Spread.SetCol(1);
m_Spread.SetRow(1);
fWidth = m_Spread.GetMaxTextCellWidth( );
m_Spread.SetColWidth(1,fWidth);
Visual Basic
' Size col width to fill max length of the text in the cell
fpSpread1.Col = 1
fpSpread1.Row = 1
fWidth = fpSpread1.MaxTextCellWidth
fpSpread1.ColWidth(1) = fWidth