Spread Windows Forms 12.0 Product Documentation
GetPreferredColumnWidth(Int32,Boolean,Boolean,Boolean) Method
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class > GetPreferredColumnWidth Method : GetPreferredColumnWidth(Int32,Boolean,Boolean,Boolean) Method
Column index
Whether to ignore column header cells
Whether to ignore spans
Whether to exclude cells with wrapped contents
Gets the width of the widest cell (based on text content) in the specified column on this sheet.
Syntax
'Declaration
 
Public Overloads Function GetPreferredColumnWidth( _
   ByVal column As Integer, _
   ByVal ignoreHeaders As Boolean, _
   ByVal ignoreSpans As Boolean, _
   ByVal excludeWordWrap As Boolean _
) As Single
'Usage
 
Dim instance As SheetView
Dim column As Integer
Dim ignoreHeaders As Boolean
Dim ignoreSpans As Boolean
Dim excludeWordWrap As Boolean
Dim value As Single
 
value = instance.GetPreferredColumnWidth(column, ignoreHeaders, ignoreSpans, excludeWordWrap)
public float GetPreferredColumnWidth( 
   int column,
   bool ignoreHeaders,
   bool ignoreSpans,
   bool excludeWordWrap
)

Parameters

column
Column index
ignoreHeaders
Whether to ignore column header cells
ignoreSpans
Whether to ignore spans
excludeWordWrap
Whether to exclude cells with wrapped contents

Return Value

Single-precision, floating-point number of pixels of the width of the cell with the widest text in the row
Remarks
Be sure to read the remarks in the Overload List for this method.
Example
This example uses the GetPreferredColumnWidth method.
float size;
size = fpSpread1.ActiveSheet.GetPreferredColumnWidth(0, true, true, true);
listBox1.Items.Add(size.ToString());
Dim Size As Integer
Size = fpSpread1.ActiveSheet.GetPreferredColumnWidth(0, True, True, True)
ListBox1.Items.Add(Size.ToString())
See Also

Reference

SheetView Class
SheetView Members
Overload List