blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-629b3da6.md
Specifies the name of the downloaded file.
Namespace : DevExpress.Blazor.RichEdit
Assembly : DevExpress.Blazor.RichEdit.v25.2.dll
NuGet Package : DevExpress.Blazor.RichEdit
[Parameter]
public string DocumentName { get; set; }
| Type | Description |
|---|---|
| String |
The name of the downloaded file.
|
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.
<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