Back to Devexpress

XlsxExportOptions.ExportMode Property

corelibraries-devexpress-dot-xtraprinting-dot-xlsxexportoptions.md

latest4.2 KB
Original Source

XlsxExportOptions.ExportMode Property

Specifies whether the source is exported as a single XLSX file or multiple files, and whether each page is exported as a separate worksheet.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[DefaultValue(XlsxExportMode.SingleFile)]
public XlsxExportMode ExportMode { get; set; }
vb
<DefaultValue(XlsxExportMode.SingleFile)>
Public Property ExportMode As XlsxExportMode

Property Value

TypeDefaultDescription
XlsxExportModeSingleFile

An XlsxExportMode enumeration value, representing the XLSX export mode.

|

Available values:

NameDescription
SingleFile

A document is exported to a single file. Note that in this mode, page headers and footers are added to the resulting XLSX file only once, at the beginning and at the end of the document.

| | SingleFilePageByPage |

A document is exported to a single file, page-by-page. In this mode, each page is exported to an individual sheet of the same XLSX file.

| | DifferentFiles |

A document is exported to multiple files, page-by-page. In this mode every document page is exported to a single XLSX file.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ExportMode
ExportOptions

.Xlsx .ExportMode

|

Remarks

The code below demonstrates to export a report to XLSX with the specific export options.

csharp
using DevExpress.XtraPrinting;
//...
    public partial class Form1 : Form {
    //...  
        private void button1_Click(object sender, EventArgs e) {
            // A path to export a report.
            string reportPath = "c:\\Test.xlsx";

            // Create a report instance.
            XtraReport1 report = new XtraReport1();

            // Get its XLSX export options.
            XlsxExportOptions xlsxOptions = report.ExportOptions.Xlsx;

            // Set XLSX-specific export options.
            xlsxOptions.ShowGridLines = true;
            xlsxOptions.TextExportMode = TextExportMode.Value;
            xlsxOptions.ExportHyperlinks = true;
            xlsxOptions.SheetName = "My Sheet";
            xlsxOptions.ExportMode = XlsxExportMode.DifferentFiles;

            // Export the report to XLSX.
            report.ExportToXlsx(reportPath);

            //...
        }
//...
vb
Imports DevExpress.XtraPrinting
'...
    Partial Public Class Form1
        Inherits Form

    '...  
        Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
            ' A path to export a report.
            Dim reportPath As String = "c:\Test.xlsx"

            ' Create a report instance.
            Dim report As New XtraReport1()

            ' Get its XLSX export options.
            Dim xlsxOptions As XlsxExportOptions = report.ExportOptions.Xlsx

            ' Set XLSX-specific export options.
            xlsxOptions.ShowGridLines = True
            xlsxOptions.TextExportMode = TextExportMode.Value
            xlsxOptions.ExportHyperlinks = True
            xlsxOptions.SheetName = "My Sheet"
            xlsxOptions.ExportMode = XlsxExportMode.DifferentFiles

            ' Export the report to XLSX.
            report.ExportToXlsx(reportPath)

            '...
        End Sub
'...

See Also

XlsxExportOptions Class

XlsxExportOptions Members

DevExpress.XtraPrinting Namespace