A newer version of this page is available. Switch to the current version.


  • 4 minutes to read

A workbook is a spreadsheet document represented by the Workbook object that is a starting point for using a non-visual spreadsheet component. This class implements the IWorkbook interface, and provides a comprehensive set of properties and methods required to modify the corresponding workbook without user interaction.


The Workbook class is defined in the DevExpress.Docs.v19.1.dll assembly. Add this assembly to your project to use the workbook functionality. You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this assembly in production code. Refer to the DevExpress Subscription page for pricing information.

A workbook consists of one or more worksheets stored within the WorksheetCollection collection. To access this collection, use the Workbook.Worksheets property.

Each worksheet has a unique name and its own position within the workbook. Thus, you can access an individual worksheet by its name or index via the WorksheetCollection.Item property.

Use other WorksheetCollection object properties to manage a workbook’s set of worksheets (add a new worksheet, remove an existing worksheet, assign an active worksheet, etc.).

A workbook may also contain specific sheets that display only a chart and do not have other data. These sheets are called chart sheets and are stored in the ChartSheetCollection collection returned by the Workbook.ChartSheets property. The ChartSheetCollection.Item property enables you to get an individual chart sheet by its name or index in the collection.

The Workbook.Sheets collection stores all sheets (worksheets and chart sheets) contained in a workbook. Use this collection when you need to access a sheet of any type.

By default, when you create a Workbook class instance, the workbook contains one empty worksheet (“Sheet1”). The same workbook is also created when you call the Workbook.CreateNewDocument method. To load an existing document, use the Workbook.LoadDocument method. To save a workbook after all modifications have been completed, use the Workbook.SaveDocument method. The Supported Formats topic lists the file formats supported for loading and saving workbooks.

You can also print a workbook using the Workbook.Print method overloads. The WorksheetView and Worksheet.PrintOptions properties allow you to set print options for each individual worksheet.

A workbook contains a collection of styles that can be used to format cell appearance in any worksheet. To access and modify this collection (for example, add new styles or modify existing styles), use the Workbook.Styles property.

The Worksheet.DefinedNames collection includes cell, formula and constant defined names that can be used in any worksheet within the workbook without qualification. See the Defined Names topic for more details.

The Workbook.DocumentSettings property provides access to an object whose members you can use to customize different workbook settings. For example, you can specify whether the R1C1 reference style should be used in a workbook (DocumentSettings.R1C1ReferenceStyle) or set different workbook calculation options (DocumentSettings.Calculation).

You can also specify other workbook options using the corresponding properties of the DocumentOptions object returned by Workbook.Options.


Resolve Performance Issues:

To improve performance while applying multiple modifications to a document, wrap your code in the Workbook.BeginUpdate-Workbook.EndUpdate method calls.

When you finish working with the Workbook, call the Workbook.Dispose method to release all the resources used by the object. This action helps you avoid memory leaks and speed up system performance. You can also modify your Workbook within the using statement (Using block in Visual Basic).

See Also