Skip to main content
A newer version of this page is available. .

IXlSheet Interface

Represents a worksheet in a workbook.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v18.1.Core.dll

Declaration

public interface IXlSheet :
    IDisposable

The following members accept/return IXlSheet objects:

Remarks

To create a new worksheet and add it to a workbook, call the IXlDocument.CreateSheet method. Use the IXlSheet object members to create worksheet columns and rows (IXlSheet.CreateColumn and IXlSheet.CreateRow), as well as objects of different types incorporated into the worksheet: hyperlinks (IXlSheet.Hyperlinks), pictures (IXlSheet.CreatePicture), etc.

For details on how to manage worksheets in a workbook, refer to the Worksheets section of examples.

Example

The example below demonstrates how to add a worksheet to a workbook. To do this, use the IXlDocument.CreateSheet method.

To specify a worksheet name, use the IXlSheet.Name property. When naming a worksheet, take into account the constraints listed in the How to: Set a Worksheet Name document. If you do not specify a worksheet name, the default name “SheetN” is used, where N is a sequential number of a worksheet within a workbook.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/xl-export-api-examples-t253492

// Create a new document.
using (IXlDocument document = exporter.CreateDocument(stream)) {

    // Specify the document culture.
    document.Options.Culture = CultureInfo.CurrentCulture;

    // Create a new worksheet under the specified name. 
    using (IXlSheet sheet = document.CreateSheet()) {
        sheet.Name = "Sales report";
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the IXlSheet interface.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also