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

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.

CutCommand.png

Right-click the cell you wish to move and select the Cut item in the context menu.

ContextMenuCut

Copy cell content

In the Clipbord group, click the Copy button, or press CTRL+C or CTRL+INSERT.

CopyCommand.png

Right-click the cell you wish to copy and select the Copy item in the context menu.

ContextMenuCopy

Paste cell content

  • In the Clipboard group, click the Paste button, or press CTRL+V or SHIFT+INSERT.

    PasteCommand.png

  • To choose special options when pasting cells, click the Paste Special button, or press CTRL+ALT+V.

    PasteSpecialCommand.png

    In the invoked Paste Special dialog box, select one of the following options.

    PasteSpecialDialogBox

    All - paste all cell content and formatting.

    Formulas - only paste formulas, as entered in the Formula Bar.

    Values - only paste cell values.

    Formats - only paste cell formatting.

    Comments - only paste the comments added to the cells.

    All except borders - paste cell content and formatting without cell borders.

    Column widths - paste the column widths of the copied cells to another range of columns.

    Formulas and number formats - only paste formulas and number formatting options from the copied cells.

    Values and number formats - only paste values and number formatting options from the copied cells.

    Skip blanks - avoid replacing values in the paste area when the copy area includes blank cells.

Right-click the cell in which you wish to paste the Clipboard content, and select the Paste item in the context menu.

ContextMenuPaste

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.