NativeExcel for .Net Developer's Reference

IWorksheet.Index Property

Returns the index number of the worksheet within the IWorksheets collection. Read-only.

[Visual Basic]
PropertyReadOnlyIndexAsInteger
[C#]
intIndex{get;}
[C++]
__propertyintget_Index();
[JScript]
functiongetIndex():int

Example

This example returns the index number of the worksheet with the specified name.

[C#]
public int NameToIndex(IWorkbook book, string Name) {
    return book.Worksheets[Name].Index;
}
[VisualBasic]
Public Function NameToIndex(Book As IWorkbook, Name As String) As Integer
   Return Book.Worksheets(Name).Index
End Function
[C++]
public int NameToIndex(IWorkbook* book, String* Name) {
    return book->Worksheets->Item[Name]->Index;
}

See Also

IWorksheet Interface | NativeExcel Namespace | IWorksheets Interface