corelibraries-devexpress-dot-export-dot-xl-d65441a6.md
Contains options related to culture-specific settings of a workbook and document format specifications and limits.
Namespace : DevExpress.Export.Xl
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public interface IXlDocumentOptions
Public Interface IXlDocumentOptions
The following members return IXlDocumentOptions objects:
To access an object exposing the IXlDocumentOptions interface, use the IXlDocument.Options property. Use the object’s properties to set the culture-specific settings of a workbook (IXlDocumentOptions.Culture), obtain the file format to which the workbook is exported (IXlDocumentOptions.DocumentFormat), get the maximum number of columns and rows supported by the output file format (IXlDocumentOptions.MaxColumnCount and IXlDocumentOptions.MaxRowCount), or check whether the specific functionality is available for the output document (IXlDocumentOptions.SupportsDocumentParts, IXlDocumentOptions.SupportsFormulas and IXlDocumentOptions.SupportsOutlineGrouping).
Note
A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples
// Create a new document.
using (IXlDocument document = exporter.CreateDocument(stream)) {
document.Options.Culture = CultureInfo.CurrentCulture;
// Create a worksheet.
using(IXlSheet sheet = document.CreateSheet()) {
using(IXlColumn column = sheet.CreateColumn()) {
column.WidthInPixels = 200;
}
using(IXlColumn column = sheet.CreateColumn()) {
column.Formatting = XlCellAlignment.FromHV(XlHorizontalAlignment.Center, XlVerticalAlignment.Bottom);
}
// Display the file format to which the document is exported.
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Document format:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.DocumentFormat.ToString().ToUpper();
}
}
// Display the maximum number of columns allowed by the output file format.
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Maximum number of columns:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.MaxColumnCount;
}
}
// Display the maximum number of rows allowed by the output file format.
using (IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Maximum number of rows:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.MaxRowCount;
}
}
// Display whether the document can contain multiple worksheets.
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Supports document parts:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.SupportsDocumentParts;
}
}
// Display whether the document can contain formulas.
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Supports formulas:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.SupportsFormulas;
}
}
// Display whether the document supports grouping functionality.
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
cell.Value = "Supports outline/grouping:";
}
using(IXlCell cell = row.CreateCell()) {
cell.Value = document.Options.SupportsOutlineGrouping;
}
}
}
}
' Create a new document.
Using document As IXlDocument = exporter.CreateDocument(stream)
document.Options.Culture = CultureInfo.CurrentCulture
' Create a worksheet.
Using sheet As IXlSheet = document.CreateSheet()
Using column As IXlColumn = sheet.CreateColumn()
column.WidthInPixels = 200
End Using
Using column As IXlColumn = sheet.CreateColumn()
column.Formatting = XlCellAlignment.FromHV(XlHorizontalAlignment.Center, XlVerticalAlignment.Bottom)
End Using
' Display the file format to which the document is exported.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Document format:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.DocumentFormat.ToString().ToUpper()
End Using
End Using
' Display the maximum number of columns allowed by the output file format.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Maximum number of columns:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.MaxColumnCount
End Using
End Using
' Display the maximum number of rows allowed by the output file format.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Maximum number of rows:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.MaxRowCount
End Using
End Using
' Display whether the document can contain multiple worksheets.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Supports document parts:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.SupportsDocumentParts
End Using
End Using
' Display whether the document can contain formulas.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Supports formulas:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.SupportsFormulas
End Using
End Using
' Display whether the document supports grouping functionality.
Using row As IXlRow = sheet.CreateRow()
Using cell As IXlCell = row.CreateCell()
cell.Value = "Supports outline/grouping:"
End Using
Using cell As IXlCell = row.CreateCell()
cell.Value = document.Options.SupportsOutlineGrouping
End Using
End Using
End Using
End Using
See Also