Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SheetView.IsSelected Property

Returns or specifies whether a sheet is selected in a workbook.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

bool IsSelected { get; set; }

#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