NativeExcel for .Net Developer's Reference

IRangeRows.Item Property (Int32)

Returns an IRangeRow interface that represents a row by using row index number.

[C#] In C#, this property is the indexer for the IRangeRows class.

[Visual Basic]
DefaultPropertyReadOnlyItem(_
ByValrowAsInteger_
)AsIRangeRow
[C#]
IRangeRowthis[
introw
]{get;}
[C++]
__propertyIRangeRow*get_Item(
introw
);
[JScript]
returnValue = IRangeRowsObject.Item( row );
-or-
returnValue = IRangeRowsObject( row );

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Parameters

row
The one-based index number of the row

Property Value

Returns an IRangeRow interface.

Example

This example changes the format for every second row on sheet one to bold.

[C#]
 IRangeRows rows = book.Worksheets[1].UsedRange.Rows;
 bool bold = false;
 for (int row = 1; row <= rows.Count; row++) {
     rows[row].Font.Bold = bold;
     bold = !bold;    
 }
[VisualBasic]
 Dim rows As IRangeRows = book.Worksheets(1).UsedRange.Rows
 Dim bold As Boolean = False
 For row As Integer = 1 To rows.Count
    rows(row).Font.Bold = bold
    bold = Not(bold)
 Next row    
[C++]
 IRangeRows* rows = book->Worksheets->Item[1]->UsedRange->Rows;
 bool bold = false;
 for (int row = 1; row <= rows->Count; row++) {
     rows->Item[row]->Font->Bold = bold;
     bold = !bold;    
 }

See Also

IRangeRows Interface | NativeExcel Namespace | IRangeRows.Item Overload List | IRangeRow Interface