GridXlExportOptions.SheetName Property
In This Article
Specifies the name of the sheet in the exported document.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
#Declaration
C#
[DefaultValue(null)]
public string SheetName { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
String | null | The sheet name. |
#Remarks
The SheetName
property allows you to specify the worksheet name. The following naming limitations apply:
- The sheet name must be unique.
- The sheet name must not exceed 31 characters.
- The sheet name must not contain the following symbols: , /, ?, :, *, [ or ].
- The sheet name must not start and end with a single quote (‘).
- The sheet name must not be an empty string.
An ArgumentException
occurs when the sheet name does not meet the aforementioned requirements.
razor
<DxGrid @ref="Grid" Data="@Data" ShowGroupPanel="true" >
<Columns>
<DxGridSelectionColumn AllowSelectAll="true" />
<DxGridDataColumn FieldName="ContactName" />
<DxGridDataColumn FieldName="ContactTitle" />
<DxGridDataColumn FieldName="CompanyName" />
<DxGridDataColumn FieldName="Country" GroupIndex="0" />
</Columns>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
IEnumerable<object> Data { get; set; }
IGrid Grid { get; set; }
protected override async Task OnInitializedAsync() {
Data = await NwindDataService.GetCustomersAsync();
}
async Task ExportXlsx_Click() {
await Grid.ExportToXlsxAsync("ExportResult", new GridXlExportOptions() {
SheetName = "Contacts",
});
}
}
To customize other sheet options, implement a delegate for the CustomizeSheet action.
See Also