The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

Worksheet.GetSelectedRanges() Method

Returns cell ranges currently selected in the worksheet.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

IList<Range> GetSelectedRanges()
Function GetSelectedRanges As IList(Of Range)
IList<Range> GetSelectedRanges()
Function GetSelectedRanges As IList(Of Range)

Returns

Type Description
IList<Range>

A list of the Range objects.

Returns

Type Description
IList<Range>

A list of the Range objects.

Remarks

The Worksheet.Selection property specifies the range of cells selected in the worksheet. The Worksheet.SelectedCell property specifies a single cell where data is inserted when an end-user types (in other words, this is an active cell). The Selection can be a single cell or contiguous or noncontiguous (union) range of cells, while the SelectedCell is always a single cell inside the current selection. If a cell you assign to SelectedCell is outside the currently selected range, the selection will be changed - it will coincide with the specified active cell.

You can also select multiple non-adjacent cells or cell ranges in the worksheet simultaneously. To get or set the list of ranges selected in the worksheet, use the GetSelectedRanges or Worksheet.SetSelectedRanges method, respectively. If there is more than one selected range in the worksheet (A2:C4, C6:C9, E3:F7, in the image below), the Worksheet.Selection property returns a complex (union) range that includes all the selected areas. You can access an individual range in the selection by its index in the Range.Areas collection.

SpreadsheetControl_Worksheet_MultipleSelectedRanges

To specify whether multi-selection is available to end-users in the SpreadsheetControl, use the SpreadsheetSelectionOptions.AllowMultiSelection option accessible via the SpreadsheetControl.Options.Behavior.Selection.AllowMultiSelection notation.

Note

The Selection, SelectedCell, ActiveCell, SetSelectedRanges and GetSelectedRanges members of the SpreadsheetControl or SpreadsheetControl object allow you to manage cell selection in the worksheet that is currently active in the control.

See Also