NativeExcel for .Net Developer's Reference

IRange.Item Property

Returns an IRange interface that represents a range at an offset to the specified range.

Overload List

Returns an IRange interface that represents a single cell by using row and column index numbers.

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

Returns an IRange interface that represents a cell or range of cells by using row and column index numbers.

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

Returns an IRange interface that represents a cell or range of cells by using A1 reference style.

[Visual Basic] Default Property ReadOnly Item(ByVal String) As IRange
[C#] IRange this[string] { get; }
[C++] __property IRange* get_Item(String*);

Returns an IRange interface that represents a cell or range of cells by using A1 reference style.

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

Example

This example sets the value of cell A1 on the first sheet to 3.14159.

[C#]
book.Worksheets[1].Range["A1"].Value = 3.14159;
[Visual Basic]
book.Worksheets(1).Range("A1").Value = 3.14159
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1"]->Value = 3.14159;
This example is the same as the previous.
[C#]
book.Worksheets[1].Range[1,1].Value = 3.14159;
[Visual Basic]
book.Worksheets(1).Range(1,1).Value = 3.14159
[C++]
book->Worksheets->Item[1]->Range->Item[1,1]->Value = 3.14159;
This example sets the font style in cells A1:D10 on the first sheet to bold.
[C#]
book.Worksheets[1].Range["A1:D10"].Font.Bold = true;
[Visual Basic]
book.Worksheets(1).Range("A1:D10").Font.Bold = True
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1:D10"]->Font->Bold = true;
This example is the same as the previous.
[C#]
book.Worksheets[1].Range[1, 1, 10, 4].Font.Bold = true;
[Visual Basic]
book.Worksheets(1).Range(1, 1, 10, 4).Font.Bold = True
[C++]
book->Worksheets->Item[1]->Range->Item[1, 1, 10, 4]->Font->Bold = true;

See Also

IRange Interface | NativeExcel Namespace | How to reference Cells and Ranges | How to reference Cells and Ranges