Back to Devexpress

DxRichEdit.DocumentName Property

blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-629b3da6.md

latest1.9 KB
Original Source

DxRichEdit.DocumentName Property

Specifies the name of the downloaded file.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
[Parameter]
public string DocumentName { get; set; }

Property Value

TypeDescription
String

The name of the downloaded file.

|

Remarks

When a user clicks a command in the Rich Text Editor’s Download Menu, the component downloads the document in the corresponding file format. Use the DocumentName property to specify the name of the downloaded document.

razor
<DxRichEdit DocumentFormat="DocumentFormat.Rtf"
            @bind-DocumentContent="@documentContent"
            DocumentName="Custom name" />

@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 canceled. */
        try {
            documentContent = await File.ReadAllBytesAsync(filePath);
            await base.OnInitializedAsync();
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}

See Also

DxRichEdit Class

DxRichEdit Members

DevExpress.Blazor.RichEdit Namespace