.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

DocumentPosition.EndUpdateDocument(SubDocument) Method

Finalizes modifications performed for the document obtained via the document's position (e.g. via the caret position).

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

public abstract void EndUpdateDocument(
    SubDocument document
)
Public MustOverride Sub EndUpdateDocument(
    document As SubDocument
)
public abstract void EndUpdateDocument(
    SubDocument document
)
Public MustOverride Sub EndUpdateDocument(
    document As SubDocument
)
public abstract void EndUpdateDocument(
    SubDocument document
)
Public MustOverride Sub EndUpdateDocument(
    document As SubDocument
)

Parameters

Name Type Description
document SubDocument

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

Parameters

Name Type Description
document SubDocument

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

Parameters

Name Type Description
document SubDocument

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

Remarks

Use the DocumentPosition.BeginUpdateDocument - DocumentPosition.EndUpdateDocument pair to modify the document obtained via the position in that document (i.e. by using the Document.CaretPosition 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.

Note

If the location of the obtained document position is ambiguous (it may belong to either header, footer or body of the document), use the EndUpdateDocument to perform modifications. Otherwise an exception may occur.

Examples

The following code snippet appends text to the end of the current paragraph. Note that the DocumentPosition.BeginUpdateDocument call is required for proper operation within header/footer since it returns a SubDocument interface.

Document document = server.Document;
document.BeginUpdate();
document.AppendText("First Paragraph\nSecond Paragraph\nThird Paragraph");
document.EndUpdate();
DocumentPosition pos = document.CaretPosition;
SubDocument doc = pos.BeginUpdateDocument();
Paragraph par = doc.Paragraphs.Get(pos);
DocumentPosition newPos = doc.CreatePosition(par.Range.End.ToInt() - 1);
doc.InsertText(newPos, "<<Appended to Paragraph End>>");
pos.EndUpdateDocument(doc);
See Also