IXlDocumentOptions Interface

Contains options related to culture-specific settings of a workbook and document format specifications and limits.

Namespace: DevExpress.Export.Xl

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

Declaration

public interface IXlDocumentOptions

The following members accept/return IXlDocumentOptions objects:

Remarks

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).

Example

// 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;
            }
        }
    }
}
See Also