The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

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.v19.2.Core.dll

Declaration

void EndUpdateDocument(
    SubDocument document
)
Sub EndUpdateDocument(
    document As SubDocument
)
void EndUpdateDocument(
    SubDocument document
)
Sub EndUpdateDocument(
    document As SubDocument
)
void EndUpdateDocument(
    SubDocument document
)
Sub EndUpdateDocument(
    document As SubDocument
)

Parameters

Name Type Description
document SubDocument

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

Parameters

Name Type Description
document SubDocument

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

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.

Examples

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
See Also