corelibraries-devexpress-dot-export-dot-xl-8e5a0f1f.md
Represents an interface that exposes the specific functionality of a workbook.
Namespace : DevExpress.Export.Xl
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public interface IXlDocument :
IDisposable
Public Interface IXlDocument
Inherits IDisposable
The following members return IXlDocument objects:
An object that exposes the IXlDocument interface is the main spreadsheet document. To create it, call the IXlExporter.CreateDocument method. To add a worksheet to the created workbook, use the IXlDocument.CreateSheet method.
Note
When you finish working with the IXlDocument object, call the Dispose method to release all the resources used by the object. Otherwise, generated content is not written to the output file. You can also modify the IXlDocument object within the using statement ( Using block in Visual Basic).
The example below demonstrates how to create a new document and write it to the specified file stream using the IXlExporter.CreateDocument method.
// 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;
}
}
' 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