Back to Devexpress

XlsxExportOptionsEx.CustomizeSheetFooter Event

corelibraries-devexpress-dot-xtraprinting-dot-xlsxexportoptionsex-f488a60c.md

latest7.0 KB
Original Source

XlsxExportOptionsEx.CustomizeSheetFooter Event

Allows you to customize the footer in the output document. Only available in data-aware export mode.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public event CustomizeSheetFooterEventHandler CustomizeSheetFooter
vb
Public Event CustomizeSheetFooter As CustomizeSheetFooterEventHandler

Remarks

To learn more about the functionality provided by this event, see XlsExportOptionsEx.CustomizeSheetHeader.

Example

This example uses the XlsxExportOptionsEx.CustomizeSheetFooter event to add a footer to an XLSX document (a result of data exporting from a Grid Control). In this event handler, two new rows are added to the output document by calling the AddRow event method, and their formatting is specified using objects of the XlFormattingObject class.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/winforms-grid-customize-data-aware-export-output

csharp
void options_CustomizeSheetFooter(ContextEventArgs e){
    // Add an empty row to the document's footer.
    e.ExportContext.AddRow();

    // Create a new row.
    var firstRow = new CellObject();
    // Specify row values.
    firstRow.Value = @"The report is generated from the NorthWind database.";
    // Specify the cell content alignment and font settings.
    var rowFormatting = CreateXlFormattingObject(true, 18);
    rowFormatting.Alignment.HorizontalAlignment = XlHorizontalAlignment.Left;
    firstRow.Formatting = rowFormatting;
    // Add the created row to the output document. 
    e.ExportContext.AddRow(new[]{ firstRow });

    // Create one more row.
    var secondRow = new CellObject();
    // Specify the row value. 
    secondRow.Value = @"The addresses and phone numbers are fictitious.";
    // Change the row's font settings.
    rowFormatting.Font.Size = 14;
    rowFormatting.Font.Bold = false;
    rowFormatting.Font.Italic = true;  
    secondRow.Formatting = rowFormatting;
    // Add this row to the output document.
    e.ExportContext.AddRow(new[]{ secondRow });
}
vb
Private Sub options_CustomizeSheetFooter(ByVal e As ContextEventArgs)
    ' Add an empty row to the document's footer.
    e.ExportContext.AddRow()

    ' Create a new row.
    Dim firstRow = New CellObject()
    ' Specify row values.
    firstRow.Value = "The report is generated from the NorthWind database."
    ' Specify the cell content alignment and font settings.
    Dim rowFormatting = CreateXlFormattingObject(True, 18)
    rowFormatting.Alignment.HorizontalAlignment = XlHorizontalAlignment.Left
    firstRow.Formatting = rowFormatting
    ' Add the created row to the output document. 
    e.ExportContext.AddRow({ firstRow })

    ' Create one more row.
    Dim secondRow = New CellObject()
    ' Specify the row value. 
    secondRow.Value = "The addresses and phone numbers are fictitious."
    ' Change the row's font settings.
    rowFormatting.Font.Size = 14
    rowFormatting.Font.Bold = False
    rowFormatting.Font.Italic = True
    secondRow.Formatting = rowFormatting
    ' Add this row to the output document.
    e.ExportContext.AddRow({ secondRow })
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomizeSheetFooter event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-customize-data-aware-export-output/CS/GridDataAwareExportCustomization/Form1.cs#L50

csharp
options.CustomizeCell += options_CustomizeCell;
options.CustomizeSheetFooter += options_CustomizeSheetFooter;
options.AfterAddRow += options_AfterAddRow;

wpf-data-grid-add-page-headers-and-footers-to-exported-data/CS/GridPrint/Window1.xaml.cs#L44

csharp
options.CustomizeSheetHeader += options_CustomizeSheetHeader;
options.CustomizeSheetFooter += options_CustomizeSheetFooter;
view.ExportToXlsx("GridExportExcel.xlsx", options);

winforms-grid-customize-data-aware-export-output/VB/GridDataAwareExportCustomization/Form1.vb#L53

vb
AddHandler options.CustomizeCell, AddressOf options_CustomizeCell
AddHandler options.CustomizeSheetFooter, AddressOf options_CustomizeSheetFooter
AddHandler options.AfterAddRow, AddressOf options_AfterAddRow

wpf-data-grid-add-page-headers-and-footers-to-exported-data/VB/GridPrint/Window1.xaml.vb#L52

vb
AddHandler options.CustomizeSheetHeader, AddressOf options_CustomizeSheetHeader
AddHandler options.CustomizeSheetFooter, AddressOf options_CustomizeSheetFooter
Me.view.ExportToXlsx("GridExportExcel.xlsx", options)

See Also

CustomizeSheetHeader

CustomizeCell

CustomizeSheetSettings

AfterAddRow

XlsxExportOptionsEx Class

XlsxExportOptionsEx Members

DevExpress.XtraPrinting Namespace