Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Description

Excerpt

Sets or returns the default column width, in points (1/72 of an inch).

Signature
C#
C#
<table class="diff-macro"><thead><tr><th class="diff-macro-title">unmigrated-wiki-markup</th></tr></thead><tbody><tr><td class="diff-macro-body"><pre>
 public double StandardWidth{ get; set; }
</pre></td></tr></tbody></table>
Signature
vb.net
vb.net
<p>Public Property StandardWidth() As Double</p>
Example
Code Block
csharp
csharp
titleC#

          //--- Get StandardWidth
          ws.StandardWidth = 100;

          //--- Set StandardWidth
          double colWidth = ws.StandardWidth;
        
Code Block
vb.net
vb.net
titlevb.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.