Worksheet Interface
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v17.2.Core.dll
Declaration
Related API Members
The following members accept/return Worksheet objects:
Remarks
A workbook consists of worksheets that are stored within the IWorkbook.Worksheets collection. An individual worksheet is a Worksheet object that can be accessed by the worksheet name or position within the workbook via the WorksheetCollection.Item property.
The Worksheet object is also a member of the SheetCollection collection, which contains all sheets in a workbook (both worksheets and ChartSheet objects). You can access an individual sheet by its name or index in the collection.
Use the Worksheet properties to access individual cells and cell ranges (Worksheet.Cells, Worksheet.Range and Worksheet.Item), entire rows and columns (Worksheet.Rows and Worksheet.Columns), as well as objects of different types incorporated into the worksheet (Worksheet.DefinedNames, Worksheet.Hyperlinks, Worksheet.Tables, Worksheet.Shapes, etc.).
The Worksheet.ActiveView property returns the WorksheetView object that specifies how the worksheet looks. Worksheet printing options are accessible via the Worksheet.PrintOptions property.
For details on how to manage worksheets in a workbook, refer to the Worksheets section of examples.
Example
This example demonstrates how to access worksheets in a workbook. Use the IWorkbook.Worksheets property to get a collection of worksheets contained in a workbook (the WorksheetCollection object).
To get an individual worksheet by its index or name, use the WorksheetCollection.Item property.
using DevExpress.Spreadsheet;
// ...
IWorkbook workbook = spreadsheetControl1.Document;
// Access a collection of worksheets.
WorksheetCollection worksheets = workbook.Worksheets;
// Access a worksheet by its index.
Worksheet worksheet1 = workbook.Worksheets[0];
// Access a worksheet by its name.
Worksheet worksheet2 = workbook.Worksheets["Sheet2"];
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Worksheet interface.
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.