Back to Devexpress

GridXlExportOptions.GroupExportMode Property

blazor-devexpress-dot-blazor-dot-gridxlexportoptions-43232373.md

latest2.4 KB
Original Source

GridXlExportOptions.GroupExportMode Property

Specifies how the grid exports group rows.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(GridGroupExportMode.KeepExpandState)]
public GridGroupExportMode GroupExportMode { get; set; }

Property Value

TypeDefaultDescription
GridGroupExportModeKeepExpandState

The group export mode.

|

Available values:

NameDescription
None

Group rows are not exported.

| | KeepExpandState |

Group rows keep their expanded state in the exported document as they are in the source grid.

| | ExpandAll |

All group rows are expanded in the exported document.

| | CollapseAll |

All group rows are collapsed in the exported document.

|

Remarks

If data rows are grouped, the grid exports the group rows keeping their expanded state. Use the GroupExportMode property to expand or collapse all rows in the exported document, or to prevent group row export.

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>
    <GroupSummary>
        <DxGridSummaryItem FieldName="ContactName" SummaryType="GridSummaryItemType.Count" />
    </GroupSummary>
</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() {
            GroupExportMode = GridGroupExportMode.ExpandAll,
        });
    }
}

See Also

GridXlExportOptions Class

GridXlExportOptions Members

DevExpress.Blazor Namespace