Back to Devexpress

XlsExportOptionsEx.CustomizeSheetSettings Event

corelibraries-devexpress-dot-xtraprinting-dot-xlsexportoptionsex-7ace395e.md

latest3.7 KB
Original Source

XlsExportOptionsEx.CustomizeSheetSettings Event

Allows you to customize the output document’s settings. 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 CustomizeSheetSettingsEventHandler CustomizeSheetSettings
vb
Public Event CustomizeSheetSettings As CustomizeSheetSettingsEventHandler

Remarks

The CustomizeSheetSettings event allows you to do the following:

  • Add the AutoFilter button to cells in a specified range ( CustomizeSheetEventArgs.ExportContext.AddAutoFilter ).
  • Anchor the output document’s header to the top and specify its fixed height ( CustomizeSheetEventArgs.ExportContext.SetFixedHeader ).

Note

The CustomizeSheetSettings event is not currently supported when exporting data from Advanced Banded Grid Views.

Example

This example handles the XlsxExportOptionsEx.CustomizeSheetSettings event to specify export settings for an XLSX document that originates from a Grid Control. The ExportContext.SetFixedHeader method is used to anchor the output document’s header to the top, and to set the fixed header height. The ExportContext.AddAutoFilter method adds the AutoFilter button to the column header cells.

View Example: How to: Customize the GridControl's Data-Aware Export Output

csharp
void options_CustomizeSheetSettings(CustomizeSheetEventArgs e) {
    // Anchor the output document's header to the top and set its fixed height. 
    const int lastHeaderRowIndex = 15;
    e.ExportContext.SetFixedHeader(lastHeaderRowIndex);
    // Add the AutoFilter button to the document's cells corresponding to the grid column headers.
    e.ExportContext.AddAutoFilter(new XlCellRange(new XlCellPosition(0, lastHeaderRowIndex), new XlCellPosition(5, 100)));
}
vb
Private Sub options_CustomizeSheetSettings(ByVal e As CustomizeSheetEventArgs)
    ' Anchor the output document's header to the top and set its fixed height. 
    Const lastHeaderRowIndex As Integer = 15
    e.ExportContext.SetFixedHeader(lastHeaderRowIndex)
    ' Add the AutoFilter button to the document's cells corresponding to the grid column headers.
    e.ExportContext.AddAutoFilter(New XlCellRange(New XlCellPosition(0, lastHeaderRowIndex), New XlCellPosition(5, 100)))
End Sub

See Also

CustomizeSheetHeader

CustomizeSheetFooter

CustomizeCell

AfterAddRow

XlsExportOptionsEx Class

XlsExportOptionsEx Members

DevExpress.XtraPrinting Namespace