Back to Devexpress

XlsxExportOptionsEx.LayoutMode Property

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

latest2.6 KB
Original Source

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.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public LayoutMode LayoutMode { get; set; }
vb
Public Property LayoutMode As LayoutMode

Property Value

TypeDescription
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.

Example

The following example shows how to change the style of the native Excel table to which data is exported from a grid control.

csharp
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);
vb
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

XlsxExportOptionsEx Class

XlsxExportOptionsEx Members

DevExpress.XtraPrinting Namespace