TreeListXlExportOptions.SelectedRowsExportMode Property
In ExportSelectedRowsOnly mode, specifies whether to export parents of selected rows.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
Declaration
[DefaultValue(TreeListSelectedRowsExportMode.Flat)]
public TreeListSelectedRowsExportMode SelectedRowsExportMode { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| TreeListSelectedRowsExportMode | Flat | An enumeration value. |
Available values:
| Name | Description |
|---|---|
| Flat | The TreeList exports selected rows as a flat list. |
| KeepHierarchy | The TreeList exports selected rows and parents (even if parent rows are unselected). |
Remarks
Note
This property is not in effect if ExportSelectedRowsOnly is set to false (default).
When exporting TreeList data to an Excel format, you can activate the ExportSelectedRowsOnly option. If active, the TreeList component ignores hierarchy and exports selected rows as flat data.

Set SelectedRowsExportMode to KeepHierarchy to export selected rows and their parents:

@rendermode InteractiveServer
@using DevExpress.Drawing
@inject SpaceObjectDataProvider SpaceObjectDataProvider
<DxTreeList @ref="TreeList" Data="TreeListData" ChildrenFieldName="Satellites">
<Columns>
<DxTreeListSelectionColumn Width="60px" AllowSelectAll="true" />
<DxTreeListDataColumn FieldName="Name" />
<DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
<DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2" />
<DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2"/>
</Columns>
<ToolbarTemplate>
<DxToolbar>
<DxToolbarItem Text="Export to XLSX" Click="ExportXlsx_Click" BeginGroup="true" />
</DxToolbar>
</ToolbarTemplate>
</DxTreeList>
@code {
ITreeList TreeList { get; set; }
object TreeListData { get; set; }
protected override async Task OnInitializedAsync() {
TreeListData = SpaceObjectDataProvider.GenerateData();
}
async Task ExportXlsx_Click() {
await TreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
ExportSelectedRowsOnly = true,
SelectedRowsExportMode = TreeListSelectedRowsExportMode.KeepHierarchy
});
}
}
See Also