Skip to main content
.NET Framework 4.5.2+

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.v22.1.Core.dll

Declaration

void EndUpdateDocument(
    SubDocument document
)

Parameters

Name Type Description
document SubDocument

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

Remarks

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.

Example

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.

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)
    doc.Delete(rangeToRemove)
    range.EndUpdateDocument(doc)
End Sub

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

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