Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeListExportOptions Class

The base class for the TreeListXlExportOptions and TreeListCsvExportOptions classes. Contains common options that define how a document is exported.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public abstract class TreeListExportOptions :
    GridExportOptionsBase

#Remarks

When you export data, descendants of the TreeListExportOptions class allow you to customize the settings of the exported data and the exported document.

Razor
<DxTreeList @ref="TreeList"
            Data="TreeListData"
            ChildrenFieldName="Satellites"
@* ... *@
            CssClass="max-h-480">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" />
        <DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" FilterRowOperatorType="TreeListFilterRowOperatorType.Equal">
            <EditSettings>
                <DxComboBoxSettings Data="TreeListRenderHelper.SpaceObjectTypes" SearchMode="@ListSearchMode.AutoSearch"
                                    SearchFilterCondition="@ListSearchFilterCondition.Contains" />
            </EditSettings>
        </DxTreeListDataColumn>
        <DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2">
            <HeaderCaptionTemplate>Mass, 10<sup>21</sup> &#215; kg</HeaderCaptionTemplate>
        </DxTreeListDataColumn>
        <DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2" />
        <DxTreeListDataColumn FieldName="Volume10pow9KM3" Caption="Volume, km³" DisplayFormat="N2">
            <HeaderCaptionTemplate>Volume, 10<sup>9</sup> &#215; km<sup>3</sup></HeaderCaptionTemplate>
        </DxTreeListDataColumn>
        <DxTreeListDataColumn FieldName="SurfaceGravity" Caption="Gravity" DisplayFormat="N2">
            <HeaderCaptionTemplate>Gravity, m/s<sup>2</sup></HeaderCaptionTemplate>
        </DxTreeListDataColumn>
    </Columns>
    <TotalSummary>
        <DxTreeListSummaryItem SummaryType="TreeListSummaryItemType.Count" FieldName="Name" />
    </TotalSummary>
    <ToolbarTemplate>
        <DxToolbar>
            <DxToolbarItem Text="Export to XLSX" Click="ExportXlsx_Click" BeginGroup="true" />
            <DxToolbarItem Text="Export to XLS" Click="ExportXls_Click" BeginGroup="true" />
            <DxToolbarItem Text="Export to CSV" Click="ExportCsv_Click" BeginGroup="true" />
        </DxToolbar>
    </ToolbarTemplate>
</DxTreeList>

@code {
    ITreeList TreeList { get; set; }
    object TreeListData { get; set; }

@* ... *@
    async Task ExportXlsx_Click() {
        await TreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
            CustomizeCell = OnCustomizeCell
        });
    }
    async Task ExportXls_Click() {
        await TreeList.ExportToXlsAsync("ExportResult", new TreeListXlExportOptions() {
            CustomizeCell = OnCustomizeCell
        });
    }
    async Task ExportCsv_Click() {
        await TreeList.ExportToCsvAsync("ExportResult");
    }
    void OnCustomizeCell(TreeListExportCustomizeCellEventArgs args) {
        if(args.ColumnFieldName == "TypeOfObject" && args.AreaType == SheetAreaType.DataArea)
            args.Formatting.Font = new XlCellFont() { Italic = true };
        args.Handled = true;
    }
}

For more information about data export in the TreeList component, refer to the following topic: Export Data in Blazor TreeList.

#Inheritance

Object
DevExpress.Blazor.Internal.GridExportOptionsBase
See Also