Document.Selection Property
Gets or sets the selected range in the document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Property Value
Type | Description |
---|---|
DocumentRange | A DocumentRange object, representing the DocumentRange.Start and DocumentRange.End positions of the selected text. |
Remarks
Use the Document.Copy, Document.Cut and Document.Paste methods without parameters to work with selection in the document.
The DocumentRange.Start and DocumentRange.End properties of the Selection provides you with the positions which characterize the selection’s start and end.
Use the SubDocument.GetText method to obtain the plain text contained in the selection.
Example
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
document.LoadDocument("Grimm.docx", DocumentFormat.OpenXml)
Dim myStart As DocumentPosition = document.CreatePosition(69)
Dim myRange As DocumentRange = document.CreateRange(myStart, 216)
document.Selection = myRange
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Selection property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.