Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example
Code Block
csharp
csharp
titleC#

          //--- Get StandardWidthInChars
          ws.StandardWidthInChars = 20;

          //--- Set StandardWidthInChars
          double colWidth = ws.StandardWidthInChars;
        
Code Block
vb.net
vb.net
titlevb.net

          '--- Get StandardWidthInChars
          ws.StandardWidthInChars = 20

          '--- Set StandardWidthInChars
          Dim colWidth As Double = ws.StandardWidthInChars
        
Remarks

The normal font for Excel 2003 (and prior) files is 10pt Arial. The normal font for Excel 2007 and later is Calibri 11pt. Both of these fonts have a 7 pixel character width, which is about 5.25 points (for a 96-dpi screen). The default StandardWidthInChars is 8.43 characters, or about 44.25 points.

Because font sizes and point values don't always convert cleanly, you should expect some small error (usually less than a point) when using this property in conjunction with StandardWidth.