Description
Sets or returns the default column width, in points (1/72 of an inch).C#
public double StandardWidth{ get ; set ; } |
vb.net
Public Property StandardWidth() As Double |
Examples
C#
//--- Get StandardWidth ws.StandardWidth = 100; //--- Set StandardWidth double colWidth = ws.StandardWidth; |
vb.net
'--- Get StandardWidth ws.StandardWidth = 100 '--- Set StandardWidth Dim colWidth As Double = ws.StandardWidth |
Remarks
The maximum width of an Excel column is defined (by Excel) as 255 characters in the workbook's 'Normal' font. Because of this, workbooks with different normal fonts may have different maximum values for this property.
Depending on your version of Excel, the default normal font is either 10pt Arial (Excel 2003 and earlier) or 11pt Calibri (Excel 2007 and later). Both of those have a character width of about 5.25 points, so the default maximum value for StandardWidth
is 1338
.
No matter your workbook's normal font, ExcelWriter will constrain this property to a valid range.
Because Excel uses character widths instead of points internally you may see some small error when reading values from this property, usually of less than a point.