Spread 8.0 Documentation
ColWidth Property
Support Options
ActiveX Reference > ActiveX Properties > ColWidth Property

Glossary Item Box

ColWidth Property


See Also    DLL    Example

Applies To

fpSpread control

Description

Sets or returns the width of the specified column. This property is available at run time only.

Syntax

C++

double CSpreadSheet::GetColWidth(long lCol);
void CSpreadSheet::SetColWidth(long lCol, double value);

Visual Basic

[form.]fpSpread.ColWidth(lCol As Long)[ = value#]

Remarks

Specify the column for which you are setting the width using the lCol parameter. lCol values are zero-based. Use the following lCol values to designate the column width for the following parts of the control:

To set the column width for . . . Use lCol value . . .
Row headers 0
All columns –1
Column specified by the Col property –2

This setting is applied to the current sheet setting unless you first set the Sheet property to specify the sheet for which you are setting the property.

The units used for the ColWidth property are specified by the UnitType property. For example, if the UnitType property is set to 2 (Twips), specify the width in twips. If you return the width of a column and it is not in twips but you need it to be, use the ColWidthToTwips method to convert the value to twips.

Note: The value set or returned by the ColWidth property does not include the width of the adjacent grid line.

If you prefer, you can allow users to resize columns by setting the UserResize and UserResizeCol properties. If the user is allowed to resize columns, when the user resizes a column, the ColWidthChange event occurs.

By default, sheets that are bound to databases automatically determine the column width based on the data in the bound database fields. You can change how the width is determined or turn off this automatic sizing by setting the DAutoSizeCols property.

Column widths can be based on the data in the cells or column using the MaxTextCellWidth and MaxTextColWidth properties. For more information, see Resizing Columns and Rows to Fit Text and Resizing a Cell to Fit the Widest Data.

Specify the height for rows using the RowHeight property.

Spread Designer

Choose the Sheet menu, then the Columns and Rows menu, select the Columns tab, and then type a number in the Column Width edit box in the Settings-Current Column group box in the Column and Row Settings dialog box.

Before setting the column width, select the column where you want to adjust the column width.

Data Type

Double

See Also

Resizing a Cell to Fit the Widest Data
Resizing Columns and Rows to Fit Text
Setting the Width of Columns
Sizing Columns in Bound Sheets

DAutoSizeCols, MaxTextCellWidth, MaxTextColWidth, RowHeight, Sheet, UnitType, UserResize, UserResizeCol properties

ColWidthChange event

ColWidthToTwips method

DLL Correspondence

SSGetColWidth, SSSetColWidth, SSGetColWidthInPixels, SSSetColWidthInPixels functions

Copyright © GrapeCity, inc. All rights reserved.