Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.2
  • Spreadsheet Document API (New)

    • 6 minutes to read

    The Spreadsheet Document API is a cross-platform .NET library in the DevExpress Office & PDF File API for .NET suite that allows you to create, load, modify, calculate, and save Microsoft Excel workbooks in code. You can use this library in desktop, web, and cloud applications (for example, Windows Forms, WPF, ASP.NET Core, and Blazor applications).

    Important

    The DevExpress object-oriented Spreadsheet Document API library is currently available as a Community Technology Preview (CTP). We do not recommend the use of pre-release libraries within mission-critical software applications. Please explore the capabilities of this new library and share your feedback so that we can make necessary changes before official release.

    To start a conversation, submit a ticket in the DevExpress Support Center.

    The library exposes a strongly typed object model. The Workbook class is the root object. The main objects form the following hierarchy:

    Workbook
    ├─ Worksheets
    │  └─ Worksheet
    │     ├─ Cells, Rows, Columns
    │     ├─ Tables, AutoFilter, MergedCells
    │     ├─ Shapes (charts, pictures, and shapes)
    │     └─ DefinedNames, ProtectedRanges
    ├─ ChartSheets
    │  └─ ChartSheet
    │     └─ Chart
    ├─ Styles, TableStyles, Theme
    └─ DefinedNames, DocumentProperties, CalculationOptions
    

    Why Migrate from the Previous Spreadsheet Document API?

    The Spreadsheet Document API implements a strongly typed object model. This model allows you to access and modify worksheets, cells, rows and columns, formatting settings and styles, tables, charts, shapes, pictures, and defined names.

    Compared to the previous Spreadsheet Document API, the new object model includes the following enhancements:

    Object Model That Mirrors the File Structure
    Spreadsheet Document API objects correspond to elements of Excel files. Collections (for example, Worksheet.Cells) contain the same content that the API saves to a file.
    Formatting Settings as Values
    Font, border, alignment, and protection settings are immutable structures. Call With methods (for example, FontFormat.WithBold(value)) to create a modified copy. The Cell.Format property contains direct formatting settings. The Cell.GetEffectiveFormat() method returns a cell’s effective formatting settings.
    Independent Worksheets
    You can create a Worksheet object without a workbook, populate it with data, and add it to a workbook later. You can also add the same worksheet to multiple workbooks.
    Shared Office Object Model
    Chart content (series, axes, and data labels) and themes use types from the DevExpress.Docs.Office namespace. The Presentation API uses the same types for charts and themes in presentations.

    Both libraries are available in v26.2.

    Spreadsheet Document API Previous Spreadsheet Document API
    NuGet package DevExpress.Docs.Spreadsheet DevExpress.Document.Processor
    Namespace DevExpress.Docs.Spreadsheet DevExpress.Spreadsheet
    Main class Workbook Workbook

    Important

    Previous and new Spreadsheet Document API libraries contain classes with the same names (for example, Workbook and Worksheet). Do not combine types from DevExpress.Spreadsheet and DevExpress.Docs.Spreadsheet namespaces in the same code.

    Supported File Formats

    The Spreadsheet Document API can load and save documents in the following formats:

    • XLSX, XLSM, XLSB, XLS
    • XLTX, XLTM, XLT
    • CSV, TXT
    • XML Spreadsheet 2003

    You can also export workbooks to PDF.

    Refer to the following help topics for additional information:

    Prerequisites

    The Spreadsheet Document API supports the following platforms, environments, and frameworks:

    • Windows, Linux, macOS
    • Azure, AWS, Docker
    • .NET 10+, .NET Framework 4.6.2+

    Add the DevExpress.Docs.Spreadsheet NuGet package to your project:

    dotnet add package DevExpress.Docs.Spreadsheet
    

    If a .NET Framework application does not use NuGet packages, add references to the following assemblies:

    • DevExpress.Data.v26.2.dll
    • DevExpress.Docs.Core.v26.2.dll
    • DevExpress.Docs.Spreadsheet.v26.2.dll
    • DevExpress.Drawing.v26.2.dll
    • DevExpress.Pdf.v26.2.Core.dll
    • DevExpress.Printing.v26.2.Core.dll

    Important

    You need a license for the DevExpress Office & PDF File API Subscription or DevExpress Universal Subscription to use this library in production code.

    Refer to the following help topics for additional information:

    Get Started

    Refer to the following tutorial to create your first Spreadsheet Document API application:

    Read Tutorial

    Features

    Workbooks

    Create, load, save, merge, and split workbooks and specify document properties.

    Worksheets and Chart Sheets

    Add, rename, copy, hide, and remove worksheets and chart sheets.

    Cells and Cell Ranges

    Access cells and ranges by reference or index, read and write cell values, insert and delete cells, and merge cells. Work with cell data types, error values, and A1-style, R1C1, 3D, and structured references.

    Rows and Columns

    Insert, delete, resize, hide, and display rows and columns.

    Cell Formatting and Styles

    Specify fonts, fills, borders, alignment, and number formats. Apply cell styles and workbook themes.

    Formulas and Functions

    Create formulas that contain cell references and Excel-compatible functions. Calculate formulas in code and assign names to cells, ranges, formulas, and constants. Create array formulas and dynamic array formulas that spill results into adjacent cells.

    Tables

    Convert cell ranges to tables, display header and total rows, add calculated columns, and apply table styles.

    Sort and Filter Data

    Sort worksheet data by values or colors and filter data by values, conditions, colors, or dynamic criteria.

    Charts, Shapes, and Pictures

    Create standard charts, including chart types introduced in Microsoft Excel 2016 (for example, waterfall, funnel, or treemap charts). Add shapes and pictures to worksheets.

    Document Security

    Protect workbooks, worksheets, and cell ranges. Encrypt workbooks, limit resource consumption during load operations, and remove unsafe content.

    Export to PDF

    Export all or specific worksheets to PDF and generate PDF/A and PDF/UA documents.

    Demos

    Explore online demos to try Spreadsheet Document API features.

    Deploy .NET Framework Applications

    To deploy a .NET Framework application that references DevExpress assemblies directly (without NuGet packages), copy the following assemblies to the application folder:

    Assembly Required For
    DevExpress.Data.v26.2.dll All applications
    DevExpress.DataVisualization.v26.2.Core.dll All applications
    DevExpress.Docs.Core.v26.2.dll All applications
    DevExpress.Docs.Spreadsheet.v26.2.dll All applications
    DevExpress.Drawing.v26.2.dll All applications
    DevExpress.Office.v26.2.Core.dll All applications
    DevExpress.Pdf.v26.2.Core.dll All applications
    DevExpress.Printing.v26.2.Core.dll All applications
    DevExpress.Spreadsheet.v26.2.Core.dll All applications
    DevExpress.Charts.v26.2.Core.dll PDF export of workbooks that contain charts
    DevExpress.TreeMap.v26.2.Core.dll PDF export of workbooks that contain charts
    DevExpress.XtraCharts.v26.2.dll PDF export of workbooks that contain charts
    DevExpress.XtraTreeMap.v26.2.dll PDF export of workbooks that contain charts

    The DevExpress installer copies these assemblies to the C:\Program Files\DevExpress 26.2\Components\Bin\Framework folder.