Back to Devexpress

XlsExportOptions.ExportMode Property

corelibraries-devexpress-dot-xtraprinting-dot-xlsexportoptions.md

latest4.2 KB
Original Source

XlsExportOptions.ExportMode Property

Specifies whether the document should be exported to a single or different XLS files, each page in a separate file.

Namespace : DevExpress.XtraPrinting

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

NuGet Package : DevExpress.Printing.Core

Declaration

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

Property Value

TypeDefaultDescription
XlsExportModeSingleFile

An XlsExportMode enumeration value.

|

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 XLS 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 XLS file.

| | DifferentFiles |

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

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ExportMode
ExportOptions

.Xls .ExportMode

|

Remarks

The code below demonstrates to export a report to XLS 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.xls";

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

            // Get its XLS export options.
            XlsExportOptions xlsOptions = report.ExportOptions.Xls;

            // Set XLS-specific export options.
            xlsOptions.ShowGridLines = true;
            xlsOptions.TextExportMode = TextExportMode.Value;
            xlsOptions.ExportHyperlinks = true;
            xlsOptions.SheetName = "My Sheet";
            xlsOptions.ExportMode = XlsExportMode.DifferentFiles;

            // Export the report to XLS.
            report.ExportToXls(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.xls"

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

            ' Get its XLS export options.
            Dim xlsOptions As XlsExportOptions = report.ExportOptions.Xls

            ' Set XLS-specific export options.
            xlsOptions.ShowGridLines = True
            xlsOptions.TextExportMode = TextExportMode.Value
            xlsOptions.ExportHyperlinks = True
            xlsOptions.SheetName = "My Sheet"
            xlsOptions.ExportMode = XlsExportMode.DifferentFiles

            ' Export the report to XLS.
            report.ExportToXls(reportPath)

            '...
        End Sub
'...

See Also

ExportMode

XlsExportOptions Class

XlsExportOptions Members

DevExpress.XtraPrinting Namespace