Back to Devexpress

TreeListXlExportOptions.CustomizeSheetFooter Property

blazor-devexpress-dot-blazor-dot-treelistxlexportoptions-5cf90a07.md

latest3.9 KB
Original Source

TreeListXlExportOptions.CustomizeSheetFooter Property

Allows you to add rows below TreeList content in the output document.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public Action<TreeListExportCustomizeSheetHeaderFooterEventArgs> CustomizeSheetFooter { get; set; }

Property Value

TypeDescription
Action<TreeListExportCustomizeSheetHeaderFooterEventArgs>

A delegate method that customizes the document footer area.

|

Remarks

The TreeList calls the CustomizeSheetFooter delegate method after TreeList data is exported. You can write the action handler to perform the following actions:

razor
@using DevExpress.Printing.ExportHelpers
@using DevExpress.Export
@using DevExpress.Export.Xl

<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" @ref="MyTreeList">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

@code {
    ITreeList MyTreeList { get; set; }

    async Task ExportXlsx_Click() {
        var options = new TreeListXlExportOptions();
        options.CustomizeSheetFooter = e => {
            // Add an empty row to the document's footer.
            e.ExportContext.AddRow();

            // Create a new row.
            var firstRow = new CellObject();
            firstRow.Value = "The report is generated from the Northwind database.";
            var rowFormat = new XlFormattingObject();
            rowFormat.Font = new XlCellFont();
            rowFormat.Font.Size = 18;
            rowFormat.Font.Bold = true;
            firstRow.Formatting = rowFormat;
            e.ExportContext.AddRow(new[] { firstRow });

            // Create one more row.
            var secondRow = new CellObject();
            secondRow.Value = "The addresses and phone numbers are fictitious.";
            rowFormat.Font.Size = 14;
            rowFormat.Font.Bold = false;
            rowFormat.Font.Italic = true;
            secondRow.Formatting = rowFormat;
            e.ExportContext.AddRow(new[] { secondRow });
        };
        await MyTreeList.ExportToXlsxAsync("ExportResult", options);
    }
}

See Also

TreeListXlExportOptions Class

TreeListXlExportOptions Members

DevExpress.Blazor Namespace