Skip to main content
A newer version of this page is available. .
Row

Worksheet Interface

Namespace: DevExpress.Spreadsheet

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

Declaration

public interface Worksheet :
    ExternalWorksheet,
    Sheet

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"];

Extension Methods

Show 41 items
See Also