NativeExcel for .Net Developer's Reference

IRange.ColumnWidth Property

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

[Visual Basic]
Property ColumnWidth As Double
[C#]
double ColumnWidth { get; set; }
[C++]
__property double get_ColumnWidth();
__property void set_ColumnWidth(double );
[JScript]
function get ColumnWidth() : double
function set ColumnWidth(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;
[Visual Basic]
 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