NativeExcel for .Net Developer's Reference

IWorksheets.ItemProperty

Returns an IWorksheet interface that represents a worksheet.

Overload List

Returns an IWorksheet by using index numbers.

[Visual Basic] DefaultPropertyReadOnlyItem(ByValInteger)AsIWorksheet
[C#] IWorksheetthis[int]{get;}
[C++] __propertyIWorksheet*get_Item(int);

Returns an IWorksheet by using sheet name.

[Visual Basic] DefaultPropertyReadOnlyItem(ByValString)AsIWorksheet
[C#] IWorksheetthis[string]{get;}
[C++] __propertyIWorksheet*get_Item(String*);

Example

This example changes the name of sheet one

[C#]
book.Worksheets[1].Name = "NewName";
[VisualBasic]
book.Worksheets(1).Name = "NewName";
[C++]
book->Worksheets->Item[1]->Name = S"NewName";
This example changes the page header of the sheet with name "My sheet"
[C#]
IWorksheet sheet = book.Worksheets["My sheet"];
if (sheet != null) {
   sheet.PageSetup.CenterHeader = "My sheet header";
}
[VisualBasic]
Dim sheet As IWorksheet
sheet = book.Worksheets("My sheet")
If Not sheet Is Nothing Then
   sheet.PageSetup.CenterHeader = "My sheet header"
End If
[C++]
IWorksheet* sheet = book->Worksheets->Item[S"My sheet"];
if (sheet != null) {
   sheet->PageSetup->CenterHeader = S"My sheet header";
}

See Also

IWorksheets Interface | NativeExcel Namespace | IWorksheet Interface | Worksheets Property