Skip to main content
All docs
V26.1
  • TreeListXlExportOptions.ExportUnboundExpressionAsFunction Property

    Specifies whether the TreeList exports unbound column expressions as functions or result values.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.Grid.v26.1.dll

    Declaration

    [DefaultValue(false)]
    public bool ExportUnboundExpressionAsFunction { get; set; }

    Property Value

    Type Default Description
    Boolean false

    true, to export unbound expressions as functions; false, to export unbound expressions as result values.

    Remarks

    If unbound column values are calculated using the UnboundExpression property, the TreeList component can export column data as results (default mode) or as formulas. To export unbound values as formulas, set the ExportUnboundExpressionAsFunction option to true. Note the following limitations:

    • If an expression references other columns, you must include these columns in the exported data. Otherwise, unbound expressions are exported as result values regardless of the ExportUnboundExpressionAsFunction property value.
    • Some functions used in expressions cannot be converted to formulas during export operations. Refer to the following topic for additional information: Criteria Language Syntax.

    Example

    The following code snippet exports Q2 Sales column values as formulas:

    @inject ISalesByRegionDataProvider SalesByRegionDataProvider
    
    <DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
    <DxTreeList Data="TreeListData"
                KeyFieldName="ID"
                ParentKeyFieldName="RegionID">
        <Columns>
            <DxTreeListDataColumn FieldName="Region" />
            <DxTreeListDataColumn FieldName="AprilSales" DisplayFormat="c0" />
            <DxTreeListDataColumn FieldName="MaySales" DisplayFormat="c0" />
            <DxTreeListDataColumn FieldName="JuneSales" DisplayFormat="c0" />
            <DxTreeListDataColumn FieldName="Q2Sales"
                                  Caption="Q2 Sales"
                                  DisplayFormat="c0"
                                  UnboundType="TreeListUnboundColumnType.Decimal"
                                  UnboundExpression="[AprilSales] + [MaySales] + [JuneSales]" />
        </Columns>
    </DxTreeList>
    
    @code {
        object TreeListData { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = SalesByRegionDataProvider.GenerateData();
        }
    
        async Task ExportXlsx_Click() {
            await TreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
                ExportUnboundExpressionAsFunction = true,
            });
        }
    }
    

    TreeList - Export unbound functions

    See Also