NativeExcel for .NET Developer's Reference

Referring to Rows

Use the Rows property to work with rows. This property returns an IRangeRows interface which represents the rows of the range.

Example

In the following example, Rows[1] returns row one of used range on Sheet1.

[C#]
book.Worksheets[1].UsedRange.Rows[1].Font.Bold = true;
        
[Visual Basic]
book.Worksheets(1).UsedRange.Rows(1).Font.Bold = True
        
[C++]
book->Worksheets->Item[1]->UsedRange->Rows->Item[1]->Font->Bold = true;
        
This example clears contents of row three in the range B5:F19.
[C#]
book.Worksheets[1].Range["B5:F19"].Rows[3].ClearContents();
        
[Visual Basic]
book.Worksheets(1).Range("B5:F19").Rows(3).ClearContents()
        
[C++]
book->Worksheets->Item[1]->Range->Item[S"B5:F19"]->Rows->Item[3]->ClearContents();
        
This example merges the first row of range B2:C5.
[C#]
book.Worksheets[1].Range["B2:C5"].Rows[1].Merge();
        
[Visual Basic]
book.Worksheets(1).Range("B2:C5").Rows(1).Merge()
        
[C++]
book->Worksheets->Item[1]->Range->Item[S"B2:C5"]->Rows->Item[1]->Merge();