NativeExcel for .Net Developer's Reference

IRange.ColumnWidth Property

Gets or sets the width of columns in the specified range.

[Visual Basic]
PropertyColumnWidthAsDouble
[C#]
doubleColumnWidth{get;set;}
[C++]
__propertydoubleget_ColumnWidth();
__propertyvoidset_ColumnWidth(double);
[JScript]
functiongetColumnWidth():double
functionsetColumnWidth(double);

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Example

This example doubles the width of column A on sheet one.

[C#]
 IRange range = book.Worksheets[1].Range["A1"];
 range.ColumnWidth *= 2;
[VisualBasic]
 Dim range As IRange = book.Worksheets(1).Range("A1")
 range.ColumnWidth = range.ColumnWidth * 2
[C++]
 IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1"];
 range->ColumnWidth *= 2;

See Also

IRange Interface | NativeExcel Namespace | RowHeight Property | Width Property