You are viewing help content for pre-release software. This document and the features it describes are subject to change.

DxRichEdit.DocumentFormat Property

Specifies the format in which the DocumentContent property stores content of an open document.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v21.2.dll


public DocumentFormat DocumentFormat { get; set; }

Property Value

Type Description

A document format.

Available values:

Name Description

Office Open XML format (DOCX).


Rich text format.


Plain text format.


If you do not assign a document’s format value to the DocumentFormat property before you open the document, the Rich Text Editor cannot parse the document correctly.

The Rich Text Editor does not update the DocumentContent property value automatically when you change the DocumentFormat property value. Call the SaveDocumentAsync() method to raise the DocumentContentChanged event and convert the DocumentContent property value to another format.

The example below demonstrates how to open an RTF document:

<DxRichEdit Id="richEdit" DocumentFormat="DocumentFormat.Rtf" @bind-DocumentContent="@documentContent"/>

@code {
    byte[] documentContent;
    string filePath = "C:\\Users\\Public\\annual-report.rtf";

    protected override async Task OnInitializedAsync() {
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
            documentContent = await File.ReadAllBytesAsync(filePath);
            await base.OnInitializedAsync();
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
See Also