RichEditControl.DocumentLoaded Event
Occurs after a document is loaded into the RichEdit control.
Namespace: DevExpress.Xpf.RichEdit
Assembly: DevExpress.Xpf.RichEdit.v24.2.dll
NuGet Package: DevExpress.Wpf.RichEdit
Declaration
Event Data
The DocumentLoaded event's data class is EventArgs.
Remarks
The DocumentLoaded event fires after executing the RichEditControl.LoadDocument or Document.LoadDocument method and after specifying values for the following properties:
- Document.Text
- Document.RtfText
- Document.OpenXmlBytes
- Document.WordMLText
- Document.HtmlText
- Document.MhtText
The DocumentLoaded fires when the document model is built and the loaded document is valid. Handle the DocumentLayout.DocumentFormatted event to check the loaded document’s layout.
The code sample below shows how to update fields in the main body of a loaded document:
richEditControl.LoadDocument("FirstLook.docx");
richEditControl.DocumentLoaded += RichEditControl_DocumentLoaded;
private void RichEditControl1_DocumentLoaded(object sender, EventArgs e)
{
richEditControl1.BeginInvoke(new Action(() =>
{
if (richEditControl1.Document.Fields.Count != 0)
{
richEditControl1.Document.Fields.Update();
}
}));
}