XlsxExportOptionsEx.LayoutMode Property
Gets or sets whether data is exported in regular mode or as a native Excel table.Only available in data-aware export mode.
Namespace: DevExpress.XtraPrinting
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
DevExpress.Export.LayoutMode | A value that specifies whether data is exported in regular mode or as a native Excel table. The default value is Standard. |
Remarks
The LayoutMode property allows you to choose between exporting data in regular mode and as a native Excel table. The property can be set to one of the following values:
Standard - The default export mode.
Table - Enables export to a native Excel table.
Exporting data to a native Excel table provides greater capabilities for data analysis and management and allows you to format cells using numerous formatting options. When exporting to a native Excel table, you can handle the XlsxExportOptionsEx.BeforeExportTable event to customize the settings of the created table.
The following list covers the limitations of native Excel table export mode:
Bands are not exported (the XlsxExportOptionsEx.BandedLayoutMode option is ignored)
A grid control supports Banded Grid Views and Advanced Banded Grid Views. Bands, however, are not exported in native Excel table mode. Columns from all visible grid bands will be stretched out in a single line in the output worksheet.
Data grouping, group columns and group summaries are not exported (the XlsxExportOptionsEx.AllowGrouping, XlsxExportOptionsEx.ShowGroupSummaries and XlsxExportOptionsEx.GroupState properties are ignored).
Data is exported as a regular list, without the grouping feature. If a column is only displayed within the source grid control’s group panel (see GridOptionsView.ShowGroupedColumns), this column’s values will not be exported.
- Changing the visibility of vertical and horizontal lines between cells is not supported
- Cell merging is disabled (the XlsxExportOptionsEx.AllowCellMerge option is ignored).
- Cell formatting (cell appearance and borders) cannot be applied to entire sheet columns (the XlsxExportOptionsEx.ApplyFormattingToEntireColumn option is ignored).
- The XlsxExportOptionsEx.SkipFooterRow event is not triggered.
- If your source grid control contains multi-line total summaries, only the first summary line will be exported (by default), since a native Excel table only supports a single total summary row. A workaround to this issue is to enable a multi-line total footer emulation by handling the XlsxExportOptionsEx.BeforeExportTable event and setting the BeforeExportTableEventArgs.UseTableTotalFooter event parameter to false.
Example
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);