DxRichEdit.DocumentName Property
In This Article
Specifies the name of the downloaded file.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
#Declaration
C#
[Parameter]
public string DocumentName { get; set; }
#Property Value
Type | Description |
---|---|
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