Skip to main content

DocumentRange.EndUpdateDocument(SubDocument) Method

Finalizes modifications of the document obtained via the document’s range (e.g. via selection).

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v23.2.Core.dll

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


void EndUpdateDocument(
    SubDocument document


Name Type Description
document SubDocument

A SubDocument instance obtained via the previously called DocumentRange.BeginUpdateDocument method.


Use the DocumentRange.BeginUpdateDocument - DocumentRange.EndUpdateDocument pair to modify the document obtained via selection (i.e. by using the Document.Selection property). In that case, it is very important to distinguish different parts of the document, such as header, footer or body. The EndUpdateDocument method implements this requirement.


The following code replaces the selected text with asterisks.

The RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.

View Example

Private Shared Sub buttonCustomAction_ItemClick_Replace(ByVal sender As Object, ByVal e As ItemClickEventArgs)
    Dim richEdit As RichEditControl = TryCast(e.Item.Tag, RichEditControl)
    Dim range As DocumentRange = richEdit.Document.Selection
    Dim selLength As Integer = range.Length
    Dim s As New String("*"c, selLength)
    Dim doc As SubDocument = range.BeginUpdateDocument()
    doc.InsertSingleLineText(range.Start, s)
    Dim rangeToRemove As DocumentRange = doc.CreateRange(range.Start, selLength)
End Sub

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