Worksheet
- 5 minutes to read
A worksheet (Worksheet) represents a single document within a spreadsheet workbook. A worksheet is used to store and manipulate data in the SpreadsheetControl. By default, the spreadsheet contains only one worksheet with the default name displayed on the Sheet Tab Selector at the bottom of the control. You can customize the tab appearance for each worksheet using the WorksheetView.TabColor property, which allows you to specify the worksheet tab color. You can also control the visibility of the Sheet Tab Selector, as well as the vertical and horizontal scrollbars, from the SpreadsheetControl.Options property, which provides access to various properties of the SpreadsheetControl such as SpreadsheetControlOptions.TabSelector, SpreadsheetControlOptions.VerticalScrollbar and SpreadsheetControlOptions.HorizontalScrollbar.
End-User Capabilities
To provide an interface that allows end-users to easily work with the spreadsheet documents, add a set of Ribbon pages to the SpreadsheetControl. For an example on how to provide a Ribbon UI for the SpreadsheetControl, see the Getting Started topic.
The SpreadsheetControl also supports keyboard shortcuts for performing operations in worksheets. For details, refer to the Shortcuts section.
The table below lists the basic end-user operations for working with worksheets via Ribbon pages (or the spreadsheet context menu), and the corresponding API methods and properties.
- Insert a new worksheet
- Delete a worksheet
- Rename a worksheet
- Hide or display a worksheet
- Specify print options
- Scroll a worksheet
- Zoom a worksheet
Action | End-user capabilities | API methods/properties |
---|---|---|
| ||
| ||
| ||
| ||
Specify print options |
| |
Use vertical and horizontal scrollbars to scroll a worksheet to the desired location. | ||
In the Zoom group within the View tab, click the Zoom In or Zoom Out button. Click the Zoom 100% button to restore the worksheet to normal size. |
End-User Restrictions
In some real-world applications, it might be necessary to prevent end-users from modifying worksheets. For instance, it may be necessary to prohibit end-users from deleting or renaming worksheets. To implement end-user restrictions, use the SpreadsheetControlOptions.Behavior property, which provides access to the restriction settings. The table below lists the restrictions you can set when working with worksheets in the SpreadsheetControl.
Restriction | Description |
---|---|
SpreadsheetWorksheetBehaviorOptions.Delete | Gets or sets whether or not end-users are allowed to delete worksheets. |
SpreadsheetWorksheetBehaviorOptions.Hide | Gets or sets whether or not end-users are allowed to hide worksheets. |
SpreadsheetWorksheetBehaviorOptions.Insert | Gets or sets whether or not end-users are allowed to insert worksheets. |
SpreadsheetWorksheetBehaviorOptions.Rename | Gets or sets whether or not end-users are allowed to rename worksheets. |
SpreadsheetWorksheetBehaviorOptions.Unhide | Gets or sets whether or not end-users are allowed to unhide worksheets. |
SpreadsheetBehaviorOptions.OfficeScrolling | Gets or sets whether or not end-users are allowed to use the Office Scrolling feature. |
SpreadsheetBehaviorOptions.Zooming | Gets or sets whether or not end-users are allowed to zoom in and out of documents. |
SpreadsheetBehaviorOptions.MaxZoomFactor | Gets or sets the upper limit of document zooming. |
SpreadsheetBehaviorOptions.MinZoomFactor | Gets or sets the lower limit of document zooming. |
Set the required property to DocumentCapability.Disabled or DocumentCapability.Hidden to disable or hide the corresponding command in the Ribbon UI and the spreadsheet popup menu. You can also prevent the context menu from being displayed, as described in the How to: Customize or Hide the Popup Menu example.