Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RichEditControl.Document Property

Provides access to a Document interface specifying the control’s document.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v24.1.dll

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap

#Declaration

[Browsable(false)]
public Document Document { get; }

#Property Value

Type Description
Document

A Document interface specifying a document loaded in the control.

#Remarks

The Document property is the main access point to the RichEdit API.

Note

The Document property gives you access only to the main document body. It means that you cannot access field or bookmark collections located in the header/footer using this property. Call the Section.BeginUpdateHeader - Section.EndUpdateHeader pair to access the Document object related to the header and footer.

Use the Document.Selection property to select a text. The following code snippet illustrates how you can select a range of 69 positions starting from the position 216 in the document:

View Example

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the Document 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.

See Also