Spread Windows Forms 6.0 Product Documentation
SetColumnWidth Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class : SetColumnWidth Method


column
Column index
value
Width in pixels

Glossary Item Box

Sets the width in pixels for the specified column on this sheet.

Syntax

Visual Basic (Declaration) 
Public Sub SetColumnWidth( _
   ByVal column As Integer, _
   ByVal value As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As SheetView
Dim column As Integer
Dim value As Integer
 
instance.SetColumnWidth(column, value)
C# 
public void SetColumnWidth( 
   int column,
   int value
)

Parameters

column
Column index
value
Width in pixels

Remarks

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.

Example

This example illustrates the use of this member by returning the width for the specified column.
C#Copy Code
fpSpread1.ActiveSheet.SetColumnWidth(0, 120); 
int i;
i = fpSpread1.ActiveSheet.GetColumnWidth(0);
listBox1.Items.Add(i.ToString());
Visual BasicCopy Code
FpSpread1.ActiveSheet.SetColumnWidth(0, 120)
Dim i As Integer
i = FpSpread1.ActiveSheet.GetColumnWidth(0)
ListBox1.Items.Add(i.ToString())

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.