How to: Create a New Workbook
- 2 minutes to read
To work with a spreadsheet document programmatically, create an instance of the Workbook class. This is a root object that serves as the starting point for using a non-visual spreadsheet engine.
Important
The Workbook class is defined in the DevExpress.
By default, a new workbook contains one empty worksheet (“Sheet1”). You can add and delete worksheets, if required. The same workbook is also created when you call the Workbook.CreateNewDocument method.
To load an existing spreadsheet document to a workbook, call the Workbook.LoadDocument method. To save a workbook to a file, use the Workbook.SaveDocument method. See the How to: Load a Document to a Workbook and How to: Save a Document to a File examples.
// Add a reference to the DevExpress.Docs.dll assembly.
using DevExpress.Spreadsheet;
// ...
// Create a new Workbook object.
Workbook workbook = new Workbook();
Note
To improve performance while applying multiple modifications to a document, wrap your code in the Workbook.
When you finish working with the Workbook, you are advised to call the Workbook.