Workbook
- 2 minutes to read
A workbook is a document in the ASPxSpreadsheet control. It is an object that exposes the IWorkbook interface. The IWorkbook interface provides a comprehensive set of properties and methods required to manipulate the corresponding workbook. To access a workbook that is currently loaded in the ASPxSpreadsheet control, use the ASPxSpreadsheet.Document property. This is the starting point for using the ASPxSpreadsheet API.
A workbook consists of one or more worksheets stored within the WorksheetCollection collection. To access this collection, use the IWorkbook.Worksheets property.
Each worksheet has a unique name and 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 the workbook’s set of worksheets (add a new worksheet, remove an existing worksheet, assign an active worksheet, etc.).
By default, when you create an ASPxSpreadsheet instance, it contains a workbook with one empty worksheet (“Sheet1”). The same workbook is also created when you call the New() method. To load an existing document into the ASPxSpreadsheet control, use the Open method. To save a workbook after all modifications are complete, use the Save() method. The Supported Formats topic lists the file formats supported for loading and saving workbooks.
A workbook contains a collection of styles, which can be used to format cell appearance in any worksheet. To access and modify this collection (for example, add a new style or modify an existing style), use the IWorkbook.Styles property.
The IWorkbook.DefinedNames collection includes cell, formula and constant defined names that can be used in any worksheet within the workbook. See the Defined Names topic for more information.
The IWorkbook.DocumentSettings property provides access to the workbook settings. For example, use the DocumentSettings.Calculation property to set different workbook calculation options.
You can also specify other workbook options using the corresponding properties of an object returned by IWorkbook.Options.
- DocumentOptions.Export, DocumentOptions.Import - Specify parameters required to import workbooks from or export workbooks to different file formats.
- DocumentOptions.DocumentCapabilities - Sets document restrictions.
- DocumentOptions.Save - Defines the file name and file format to be used when saving a workbook.