Back to Devexpress

RichEditDocumentServer.DocumentLoaded Event

officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-94314de1.md

latest3.3 KB
Original Source

RichEditDocumentServer.DocumentLoaded Event

Occurs after a document is loaded.

Namespace : DevExpress.XtraRichEdit

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public event EventHandler DocumentLoaded
vb
Public Event DocumentLoaded As EventHandler

Event Data

The DocumentLoaded event's data class is EventArgs.

Remarks

The DocumentLoaded event fires after the RichEditDocumentServer.LoadDocument or Document.LoadDocument method call. The event is also raised when the following properties change their values:

The DocumentLoaded fires when the document model is built and the loaded document is valid.

Note

The RichEditDocumentServer does not provide a technique to determine the moment when all images with external references are downloaded and inserted in an HTML document.

The code sample below shows how to update fields in the main body of a loaded document:

csharp
richEditDocumentServer.LoadDocument("FirstLook.docx");
richEditDocumentServer.DocumentLoaded += RichEditDocumentServer_DocumentLoaded;

private void RichEditDocumentServer_DocumentLoaded(object sender, EventArgs e)
{
    RichEditDocumentServer control = sender as RichEditDocumentServer;
    if (control.Document.Fields.Count != 0)
    {
        control.Document.Fields.Update();
    }
}
vb
richEditControl.LoadDocument("FirstLook.docx")
AddHandler richEditControl.DocumentLoaded, AddressOf RichEditControl_DocumentLoaded

Private Sub RichEditControl_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs)
    Dim control As RichEditControl = TryCast(sender, RichEditControl)
    If control.Document.Fields.Count <> 0 Then
        control.Document.Fields.Update()
    End If
End Sub

Implements

DocumentLoaded

See Also

RichEditDocumentServer Class

RichEditDocumentServer Members

DevExpress.XtraRichEdit Namespace