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

Graphics device interface
Column index

Glossary Item Box

Gets the width of the widest cell (based on text content) in the specified column on this sheet for printing to the specified graphics device.


Visual Basic (Declaration) 
Public Function GetPreferredPrintColumnWidth( _
   ByVal g As Graphics, _
   ByVal column As Integer _
) As Single
Visual Basic (Usage)Copy Code
Dim instance As SheetView
Dim g As Graphics
Dim column As Integer
Dim value As Single
value = instance.GetPreferredPrintColumnWidth(g, column)
public float GetPreferredPrintColumnWidth( 
   Graphics g,
   int column


Graphics device interface
Column index

Return Value

Single-precision, floating-point number of in pixels of the width in the widest cell (based on text contents)


This example returns the width of the widest cell (based on text contents) in the first column on this sheet.
C#Copy Code
private void GetPrintWidth(Graphics g, float s, FarPoint.Win.Spread.SheetView sheet) 
    sheet = fpSpread1.ActiveSheet; s = sheet.GetPreferredPrintColumnWidth(g, 0); 

private void button1_Click(object sender, System.EventArgs e)
     Graphics g;
     g = fpSpread1.CreateGraphics();
     float sngl = 0;
     GetPrintWidth(g, sngl, fpSpread1.ActiveSheet); MessageBox.Show(sngl.ToString()); } 
Visual BasicCopy Code
Private Sub GetPrintWidth(ByVal g As Graphics, ByVal s As Single, ByVal sheet As FarPoint.Win.Spread.SheetView) 
     sheet = FpSpread1.ActiveSheet 
     s = sheet.GetPreferredPrintColumnWidth(g, 0) 
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     Dim g As Graphics
     g = FpSpread1.CreateGraphics()
     Dim sngl As Single
     GetPrintWidth(g, sngl, FpSpread1.ActiveSheet)
End Sub 


Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also


SheetView Class
SheetView Members

User-Task Documentation

Managing Printing

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