Skip to main content
A newer version of this page is available. .

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.

 

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.

NewWorkbook.png

SpreadsheetControl.CreateNewDocument

ISpreadsheetComponent.CreateNewDocument

How to: Create a New Workbook

Load a workbook

Click the Open button in the Common group, or press CTRL+O.

LoadWorkbook.png

The SpreadsheetControl supports the following file formats.

  • Excel Workbook (*.xlsx)
  • Excel Macro-Enabled Workbook (*.xlsm)
  • Excel 97-2003 Workbook (*.xls)
  • Tab-delimited Text File format (*.txt)
  • Comma-separated Values File format (*.csv)

SpreadsheetControl.LoadDocument

ISpreadsheetComponent.LoadDocument

How to: Load a Document into SpreadsheetControl

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.

SaveAsDialog.png

The SpreadsheetControl allows you to save a document in the following formats.

  • Excel Workbook (*.xlsx)
  • Excel Macro-Enabled Workbook (*.xlsm)
  • Excel 97-2003 Workbook (*.xls)
  • Tab-delimited Text File format (*.txt)
  • Comma-separated Values File format (*.csv)

SpreadsheetControl.SaveDocument

ISpreadsheetComponent.SaveDocument

How to: Save a Document to a File

Print a workbook

Before printing a workbook, you can specify print settings for each worksheet separately, as described in the Worksheet topic.

  • To view a workbook as it will be printed, click the Print Preview button in the Common group.

    PrintPreview.png

  • To print a document, click the Print button, or press CTRL+P.

    PrintButton.png

  • To send a workbook directly to the default printer without setting print options, click the Quick Print button.

    QuickPrintButton.png

Printing

Specify document properties

To view and edit document properties, invoke the Properties dialog by clicking the Document Properties button in the Info group.

SpreadsheetControl_ DocPropertiesButton

IWorkbook.DocumentProperties

DocumentProperties.Custom

How to: Specify Document Properties

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.