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.BeginUpdateDocument() Method

Starts modifying 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

SubDocument BeginUpdateDocument()
Function BeginUpdateDocument As SubDocument
SubDocument BeginUpdateDocument()
Function BeginUpdateDocument As SubDocument
SubDocument BeginUpdateDocument()
Function BeginUpdateDocument As SubDocument

Returns

Type Description
SubDocument

A SubDocument instance allowing you to safely modify the document.

Returns

Type Description
SubDocument

A SubDocument instance allowing you to safely modify the document.

Returns

Type Description
SubDocument

A SubDocument instance allowing you to safely modify the document.

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 BeginUpdateDocument method implements this requirement.

Examples

This code sample demonstrates how to use and modify the selected part of the document. The selection can be located in the main part of the document, within the table, in the header, footer or in a text box. The DocumentRange.BeginUpdateDocument method is a versatile method for accessing any document range, irrespective of its location. You are advised to obtain the selection using the Document.Selection property and use the SubDocument methods within the DocumentRange.BeginUpdateDocument - DocumentRange.EndUpdateDocument method pair.

DocumentRange range = richEditControl1.Document.Selection;
SubDocument doc = range.BeginUpdateDocument();
string plainText = doc.GetText(range);
MessageBox.Show(plainText, "Selected Text");
doc.InsertText(range.Start,"->");
doc.InsertText(range.End, "<-");
range.EndUpdateDocument(doc);
See Also