Skip to main content

Document.ChangeActiveDocument(SubDocument) Method

Enables you to operate on selections in documents other than the main document, such as headers and footers.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation


void ChangeActiveDocument(
    SubDocument document


Name Type Description
document SubDocument

A SubDocument object that is the document that is different from the currently active document.


The following code snippet demonstrates how you can select a bookmark in the header. Note that the use of the ChangeActiveDocument is mandatory, otherwise the BookmarkCollection.Select method will fail.

// Find the bookmark.
SubDocument myDoc = richEditControl1.Document.Sections[0].BeginUpdateHeader(HeaderFooterType.Even);
Bookmark bmark = myDoc.Bookmarks[0];            
// Select the bookmark.
SubDocument subDoc = bmark.Range.BeginUpdateDocument();

The following code snippets (auto-collected from DevExpress Examples) contain references to the ChangeActiveDocument(SubDocument) method.


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