Skip to main content
A newer version of this page is available. .

XlsExportOptionsEx.CustomizeSheetFooter Event

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

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v19.1.Core.dll

Declaration

public event CustomizeSheetFooterEventHandler CustomizeSheetFooter

Remarks

The CustomizeSheetFooter event is raised after data is exported. It enables you to do the following:

  • Add new rows to the output document to create a footer (ContextEventArgs.ExportContext.AddRow).
  • Insert an image into a specified cell range in the footer (ContextEventArgs.ExportContext.InsertImage).
  • Merge cells in the footer (ContextEventArgs.ExportContext.MergeCells).

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.

GridExportOutputResult

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 });
}
See Also