.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

Document.Selection Property

Gets or sets the selected range in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

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


DocumentRange Selection { get; set; }

Property Value

Type Description

A DocumentRange object, representing the DocumentRange.Start and DocumentRange.End positions of the selected text.


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.


document.LoadDocument("Grimm.docx", DocumentFormat.OpenXml)
Dim myStart As DocumentPosition = document.CreatePosition(69)
Dim myRange As DocumentRange = document.CreateRange(myStart, 216)
document.Selection = myRange
See Also