SelectionCollection Class
A collection of selections in the document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
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
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
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