Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

SelectionCollection Class

A collection of selections in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v20.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

Declaration

public class SelectionCollection :
    IEnumerable<DocumentRange>,
    IEnumerable

Remarks

All ranges selected in the document are contained in this collection. To add an item to the collection, select a range with a keyboard or mouse, or use the SelectionCollection.Add method.

To toggle selection, that is to unselect a previously selected range, use the SelectionCollection.RemoveAt method.

To unselect an arbitrary range, use the SelectionCollection.Unselect method.

The SelectionCollection object is accessible using the Document.Selections property.

Example

document.LoadDocument("SelectionCollection.docx", DocumentFormat.OpenXml)
Dim range1 As DocumentRange = document.CreateRange(80, 100)
Dim range2 As DocumentRange = document.CreateRange(300, 100)
Dim startPos3 As Integer = document.Tables(0).Rows(0).LastCell.ContentRange.Start.ToInt()
Dim range3 As DocumentRange = document.CreateRange(startPos3, 100)
Dim range4 As DocumentRange = document.CreateRange(720, 100)
document.Selections.Add(New List(Of DocumentRange)() From {range1, range2, range3, range4})

Inheritance

Object
SelectionCollection

Extension Methods

See Also