Back to Devexpress

IXlExporter Interface

corelibraries-devexpress-dot-export-dot-xl-5f08b0cc.md

latest2.9 KB
Original Source

IXlExporter Interface

Represents an exporter used to create a spreadsheet document and export it to a stream.

Namespace : DevExpress.Export.Xl

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public interface IXlExporter
vb
Public Interface IXlExporter

The following members return IXlExporter objects:

Remarks

To create an object that exposes the IXlExporter interface, use the XlExport.CreateExporter method.

To generate a new spreadsheet document and write it to a stream, call the IXlExporter.CreateDocument method.

Example

The example below demonstrates how to create a new document and write it to the specified file stream using the IXlExporter.CreateDocument method.

csharp
// Create an exporter instance. 
IXlExporter exporter = XlExport.CreateExporter(XlDocumentFormat.Xlsx);
// Create the FileStream object with the specified file path. 
using (FileStream stream = new FileStream("Document.xlsx", FileMode.Create, FileAccess.ReadWrite))
{

    // Create a new document and write it to the specified stream. 
    using (IXlDocument document = exporter.CreateDocument(stream))
    {
        // Specify the document culture.
        document.Options.Culture = CultureInfo.CurrentCulture;
    }
}
vb
' Create an exporter instance. 
Dim exporter As IXlExporter = XlExport.CreateExporter(XlDocumentFormat.Xlsx)
' Create the FileStream object with the specified file path. 
Using stream As New FileStream("Document.xlsx", FileMode.Create, FileAccess.ReadWrite)

    ' Create a new document and write it to the specified stream. 
    Using document As IXlDocument = exporter.CreateDocument(stream)
        ' Specify the document culture.
        document.Options.Culture = CultureInfo.CurrentCulture
    End Using
End Using

See Also

IXlExporter Members

DevExpress.Export.Xl Namespace