NativeExcel for .Net Developer's Reference


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*);


This example changes the name of sheet one

book.Worksheets[1].Name = "NewName";
book.Worksheets(1).Name = "NewName";
book->Worksheets->Item[1]->Name = S"NewName";
This example changes the page header of the sheet with name "My sheet"
IWorksheet sheet = book.Worksheets["My sheet"];
if (sheet != null) {
   sheet.PageSetup.CenterHeader = "My sheet header";
Dim sheet As IWorksheet
sheet = book.Worksheets("My sheet")
If Not sheet Is Nothing Then
   sheet.PageSetup.CenterHeader = "My sheet header"
End If
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