Skip to main content
All docs
V25.2
  • TreeListSelectedRowsExportMode Enum

    Lists values that specify whether the TreeList preserves row hierarchy in ExportSelectedRowsOnly mode.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    public enum TreeListSelectedRowsExportMode

    Members

    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).

    Related API Members

    The following properties accept/return TreeListSelectedRowsExportMode values:

    Remarks

    When exporting TreeList data to PDF/XLS/XLSX, enable the ExportSelectedRowsOnly property to export selected rows only. Once enabled, the TreeList component ignores hierarchy and exports selected records as flat data. Set SelectedRowsExportMode to KeepHierarchy to export selected rows and their parents.

    The following example exports selected rows and their parents to XLSX:

    @rendermode InteractiveServer
    @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
            });
        }
    }
    

    Excel Export - Flat Selected Rows Export Mode

    See Also