SpreadsheetControl.ActiveWorksheet Property

Gets the worksheet that is currently displayed in the SpreadsheetControl.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v20.1.dll

Declaration

[Browsable(false)]
public Worksheet ActiveWorksheet { get; }
<Browsable(False)>
Public ReadOnly Property ActiveWorksheet As Worksheet

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.

Examples

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

Implements

DevExpress.XtraSpreadsheet.ISpreadsheetControl.ActiveWorksheet
See Also