| Visual Basic (Declaration) | |
|---|---|
Public Property Width As Single | |
| Visual Basic (Usage) | Copy Code |
|---|---|
| |
| C# | |
|---|---|
public float Width {get; set;} | |
Return Value
Value of the width in pixels| Exception | Description |
|---|---|
| ArgumentOutOfRangeException | Specified width is out of range; must be between -1 and 9,999,999 pixels |
This example determines the width of the column based on the text in the first cell.
| Visual Basic | Copy Code |
|---|---|
Dim col As FarPoint.Win.Spread.Column | |
| C# | Copy Code |
|---|---|
FarPoint.Win.Spread.Column col; | |
This is equivalent to the SheetView.SetColumnWidth method. For more information on setting the size of the column, refer to Setting the Row Height or Column Width.
Column widths can be based on the data in the cells using the GetPreferredWidth method or SheetView.GetPreferredColumnWidth method. For more information, see Resizing the Row and Column to Fit the Data.
You can allow users to resize columns by setting the Resizable property. If the user is allowed to resize columns, when the user resizes a column, the FpSpread.ColumnWidthChanged and SheetView.ColumnChanged events occur.