Skip to main content

GridXlExportOptions.SheetName Property

Specifies a name of the sheet in the exported document.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
public string SheetName { get; set; }

Property Value

Type Default Description
String null

The sheet name.

Remarks

According to the Microsoft Excel requirements, the worksheet names cannot:

  • Be blank.
  • Contain more than 31 characters.
  • Contain any of the following characters: / \ ? * : [ ]
  • Begin or end with an apostrophe (‘).
  • Be named “History”. This is a reserved word Excel uses internally.
<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.

View Example: Customize Export Settings

See Also