corelibraries-devexpress-dot-xtraprinting-dot-xlsexportoptionsex-4341239b.md
Allows you to customize a native Excel table’s settings before export. This event is in effect when the XlsExportOptionsEx.LayoutMode property is set to Table.Only available in data-aware export mode.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public event BeforeExportTable BeforeExportTable
Public Event BeforeExportTable As BeforeExportTable
The following example shows how to change the style of the native Excel table to which data is exported from a grid control.
using DevExpress.Export.Xl;
using DevExpress.XtraPrinting;
string path = "gridNative.xlsx";
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
options.LayoutMode = DevExpress.Export.LayoutMode.Table;
options.BeforeExportTable += ea => {
ea.Table.Style.Name = XlBuiltInTableStyleId.Medium1;
};
gridControl1.ExportToXlsx(path, options);
Imports DevExpress.Export.Xl
Imports DevExpress.XtraPrinting
Dim path As String = "gridNative.xlsx"
Dim options As XlsxExportOptionsEx = New XlsxExportOptionsEx()
options.LayoutMode = DevExpress.Export.LayoutMode.Table
AddHandler options.BeforeExportTable,
Sub(ea)
ea.Table.Style.Name = XlBuiltInTableStyleId.Medium1
End Sub
gridControl1.ExportToXlsx(path, options)
See Also