Back to Devexpress

Worksheet.Index Property

officefileapi-devexpress-dot-spreadsheet-dot-worksheet-c9bb2c42.md

latest5.8 KB
Original Source

Worksheet.Index Property

Gets the worksheet index within the workbook’s WorksheetCollection collection.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
int Index { get; }
vb
ReadOnly Property Index As Integer

Property Value

TypeDescription
Int32

An integer value specifying a zero-based index of the worksheet.

|

Remarks

Use the Index property to obtain the position of the worksheet within the workbook’s collection of worksheets (IWorkbook.Worksheets). Note that a workbook must always contain at least one visible sheet.

To move a worksheet to another location in a workbook, use the Worksheet.Move method, or methods inherited from the Sheet interface: Sheet.MoveToBeginning, Sheet.MoveBefore, Sheet.MoveAfter, or Sheet.MoveToEnd (for details, see the How to: Move a Worksheet to Another Location in a Workbook example).

The following code snippets (auto-collected from DevExpress Examples) contain references to the Index property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/ExportActions.cs#L31

csharp
// Specify the part of the document to be exported to HTML.
options.SheetIndex = worksheet.Index;
options.Range = "B11:O28";

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ExportActions.cs#L33

csharp
// Specify the part of the document to be exported to HTML.
options.SheetIndex = worksheet.Index;
options.Range = "B11:O28";

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/ExportActions.cs#L20

csharp
// Specify the cell range you want to save as HTML.
options.SheetIndex = worksheet.Index;
options.Range = "B2:G7";

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/ExportActions.vb#L28

vb
' Specify the part of the document to be exported to HTML.
options.SheetIndex = worksheet.Index
options.Range = "B11:O28"

wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ExportActions.vb#L30

vb
' Specify the part of the document to be exported to HTML.
options.SheetIndex = worksheet.Index
options.Range = "B11:O28"

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/ExportActions.vb#L17

vb
' Specify the cell range you want to save as HTML.
options.SheetIndex = worksheet.Index
options.Range = "B2:G7"

See Also

How to: Access a Worksheet

How to: Move a Worksheet to another Location

Worksheets in Spreadsheet Documents

Worksheet Interface

Worksheet Members

DevExpress.Spreadsheet Namespace