Clipboard Operations
- 3 minutes to read
The SpreadsheetControl enables the use of Cut, Copy and Paste commands to copy and paste cell content, or specific attributes of a cell. To enable end-users to perform Clipboard operations, add the Clipboard Ribbon page group to the SpreadsheetControl. To see an example on how to provide a Ribbon UI for the SpreadsheetControl, refer to the Getting Started topic.
The table below lists end-user capabilities to cut, copy and paste cell content via the Ribbon UI and the spreadsheet context menu. You can also copy data from one cell to another in code by using the Range.CopyFrom method. Pass the source cell object and the required value of the PasteSpecial enumerator as parameters. For an example, refer to the How to: Copy Cell Data Only, Cell Style Only, or Cell Data with Style topic.
Operation | How to implement the operation via the Ribbon UI | How to implement the operation via the context menu |
---|---|---|
Cut cell content | In the Clipboard group, click the Cut button, or press CTRL+X or SHIFT+DELETE. | Right-click the cell you wish to move and select the Cut item in the context menu. |
Copy cell content | In the Clipbord group, click the Copy button, or press CTRL+C or CTRL+INSERT. | Right-click the cell you wish to copy and select the Copy item in the context menu. |
Paste cell content |
| Right-click the cell in which you wish to paste the Clipboard content, and select the Paste item in the context menu. |
End-User Restrictions
To prevent end-users from performing Clipboard operations, use the SpreadsheetControlOptions.Behavior property, which provides access to restriction settings. The table below lists possible restrictions you can set when an end-user works with the Clipboard in the SpreadsheetControl.
Restriction | Description |
---|---|
SpreadsheetBehaviorOptions.Cut | Gets whether or not end-users are allowed to perform the Cut operation. |
SpreadsheetBehaviorOptions.Copy | Gets whether or not end-users are allowed to perform the Copy operation. |
SpreadsheetBehaviorOptions.Paste | Gets whether or not end-users are allowed to perform the Paste operation. |
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. To reinforce the protective effect, you can prevent the context menu from being displayed. For details, refer to the How to: Customize or Hide the Popup Menu example.