Workbook
- 3 minutes to read
A workbook (IWorkbook) represents a SpreadsheetControl file. To access the workbook that is currently loaded in the SpreadsheetControl, use the SpreadsheetControl.Document property. By default, when you start a spreadsheet application, it already contains a workbook with an empty worksheet. To provide end-users with the capability to load, save and print a workbook, add the Common Ribbon page group to the SpreadsheetControl. To see an example of how to provide a Ribbon UI for the SpreadsheetControl, refer to Getting Started.
The table below lists basic operations that enable end-users to work with workbooks, and the corresponding API methods and properties.
- Create a blank workbook
- Load a workbook
- Save a workbook
- Print a workbook
- Specify document properties
Action | End-user capabilities | API methods/properties |
---|---|---|
Create a blank workbook | Click the New button in the Common group within the File tab, or press CTRL+N. | SpreadsheetControl.CreateNewDocument |
Load a workbook | Click the Open button in the Common group, or press CTRL+O. The SpreadsheetControl supports the following file formats.
| SpreadsheetControl.LoadDocument |
Save a workbook | Click the Save as button in the Common group, or press F12, to save a newly created workbook. Click the Save button, or press CTRL+S to save the active workbook in its current file format and location. The SpreadsheetControl allows you to save a document in the following formats.
| SpreadsheetControl.SaveDocument |
Print a workbook | Before printing a workbook, you can specify print settings for each worksheet separately, as described in the Worksheet topic.
| |
Specify document properties | To view and edit document properties, invoke the Properties dialog by clicking the Document Properties button in the Info group. |
End-User Restrictions
To restrict end-user actions when working with workbooks, use the SpreadsheetControlOptions.Behavior property, which provides access to restriction settings. The table below lists possible restrictions you can set when working with workbooks in the SpreadsheetControl.
Restriction | Description |
---|---|
SpreadsheetBehaviorOptions.CreateNew | Gets or sets whether end-users are allowed to create new documents. |
SpreadsheetBehaviorOptions.Open | Gets or sets whether end-users are allowed to open documents. |
SpreadsheetBehaviorOptions.Print | Gets or sets whether end-users are allowed to print documents. |
SpreadsheetBehaviorOptions.Save | Gets or sets whether end-users are allowed to save documents. |
SpreadsheetBehaviorOptions.SaveAs | Gets or sets whether end-users are allowed to perform the Save Document As operation. |
Set the required property to DocumentCapability.Disabled or DocumentCapability.Hidden to disable or hide the corresponding command in the Ribbon UI.