SheetView.IsSelected Property
Returns or specifies whether a sheet is selected in a workbook.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
Boolean | true if the sheet is selected; otherwise, false. |
Remarks
Select Sheets
The following example shows how to select all odd sheets in a workbook:
SheetCollection sheets = workbook.Sheets;
for (int i = sheets.Count - 1; i >= 0; i--)
if (i % 2 == 0)
sheets[i].ActiveView.IsSelected = true;
Use the SheetCollection.ActiveSheet property to specify the active sheet in the document. The IsSelected property value is always true for the active sheet and cannot be changed to false.
Retrieve Selected Sheets
The following example retrieves names of selected sheets:
using System.Collections.Generic;
using DevExpress.Utils.Extensions;
using DevExpress.Spreadsheet;
// ...
SheetCollection sheets = workbook.Sheets;
List<string> selectedSheetNames = new List<string>();
sheets.ForEach((sheet) => {
if (sheet.ActiveView.IsSelected)
selectedSheetNames.Add(sheet.Name);
});
See Also