NativeExcel for .Net Developer's Reference

IRangeColumns.Item Property

Returns a single column or subsequence of columns from the specified range.

Overload List

Returns an IRangeColumn interface that represents a column by using column index number.

[Visual Basic] Default Property ReadOnly Item(ByVal Integer) As IRangeColumn
[C#] IRangeColumn this[int] { get; }
[C++] __property IRangeColumn* get_Item(int);

Returns IRangeColums interface that represents a subsequence or columns.

[Visual Basic] Default Property ReadOnly Item(ByVal Integer,ByVal Integer) As IRangeColumns
[C#] IRangeColumns this[int,int] { get; }
[C++] __property IRangeColumns* get_Item(int,int);

Example

This example sets the width of the first column in sheet one.

[C#]
 book.Worksheets[1].Cells.Columns[1].ColumnWidth = 20; 
[Visual Basic]
 book.Worksheets[1].Cells.Columns(1).ColumnWidth = 20
[C++]
 book->Worksheets->Item[1]->Cells->Columns;->Item[1]->ColumnWidth = 20;
This example sets the width of columns one through five on sheet one.
[C#]
 book.Worksheets[1].Cells.Columns[1,5].ColumnWidth = 20; 
[Visual Basic]
 book.Worksheets[1].Cells.Columns(1,5).ColumnWidth = 20
[C++]
 book->Worksheets->Item[1]->Cells->Columns->Item[1,5]->ColumnWidth = 20;

See Also

IRangeColumns Interface | NativeExcel Namespace | IRangeColumn Interface | IRange.Columns Property