SpreadsheetControl.ActiveWorksheet Property
Gets the worksheet that is currently displayed in the SpreadsheetControl.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
Worksheet | A Worksheet object that specifies the active worksheet. |
Remarks
A document loaded in the SpreadsheetControl is a workbook that consists of one or more worksheets (WorksheetCollection). A worksheet that is currently displayed in the SpreadhsheetControl and available to be modified by an end-user is called an active worksheet and returned by the ActiveWorksheet property.
You can also access and change an active worksheet in code using the WorksheetCollection.ActiveWorksheet property. An end-user can switch between worksheets using the SpreadsheetControl’s Sheet Tab Selector. Before and after an active worksheet is changed via the control’s UI, the SpreadsheetControl.ActiveSheetChanging and SpreadsheetControl.ActiveSheetChanged events are raised, respectively.
Example
To set an active worksheet within a workbook, assign the corresponding Worksheet object to the WorksheetCollection.ActiveWorksheet property.
// Set the second worksheet ("Sheet2") as the active worksheet.
workbook.Worksheets.ActiveWorksheet = workbook.Worksheets["Sheet2"];
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveWorksheet 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.