SpreadsheetControl.ActiveWorksheet Property

Gets the worksheet that is currently displayed in the SpreadsheetControl.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v21.1.dll

Declaration

[Browsable(false)]
public Worksheet ActiveWorksheet { get; }

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.

View Example

// Set the second worksheet ("Sheet2") as the active worksheet.
workbook.Worksheets.ActiveWorksheet = workbook.Worksheets["Sheet2"];
See Also