Skip to main content

TdxSpreadSheetTableView.PasteFromClipboard(TdxSpreadSheetClipboardPasteOptions) Method

Inserts the clipboard’s content into the current cell selection.

Declaration

procedure PasteFromClipboard(AOptions: TdxSpreadSheetClipboardPasteOptions); overload; virtual;

Parameters

Name Type
AOptions TdxSpreadSheetClipboardPasteOptions

Remarks

Call this procedure to populate cell selection(s) with the clipboard’s content. The PasteFromClipboard procedure call result depends on the clipboard content:

  • Cell data in the SpreadsheetML (XML Spreadsheet) or ExpressSpreadSheet internal binary clipboard format. In this case, the first overloaded variant inserts the clipboard content into the selected range as is, including values, formatting, formula expressions, and associated comment containers. The second overloaded variant can omit certain concomitant data in the resulting cell range, depending on Paste Special settings passed as the AOptions parameter.

  • A floating container in the ExpressSpreadSheet internal binary format. The PasteFromClipboard procedure anchors the container to the focused cell’s upper-left corner. If a floating container is focused, the pasted container (that is, a shape, picture, or text box) shifts 10 pixels down and right from the destination container’s upper-left corner. If the clipboard contains a comment container, the procedure associates it with the focused cell that has no comments or raises the EdxSpreadSheetError exception if the focused cell already has a comment.

  • Plain text or an RTF-formatted string. In this case, the procedure inserts a text string to the focused cell or the upper-left cell in the last selected cell range. All the source text’s formatting information is lost; the destination cell applies its font attributes to the pasted string.

  • A bitmap image. The PasteFromClipboard procedure creates a new floating picture container and inserts it into the worksheet in the same manner as a floating container stored in the ExpressSpreadSheet internal binary clipboard format.

Unlike CopyToClipboard and CutToClipboard, the PasteFromClipboard procedure can work with multiple cell selections. If the clipboard contains a cell range and there are several identical cell selections whose dimensions match the stored range, the PasteFromClipboard procedure uses it to populate all selections. The paste operation raises an EdxSpreadSheetError exception if the target cell ranges are not identical and/or their dimensions do not match those of the source range:

Multiple Paste Selections

End-users can paste the clipboard’s content into the worksheet by:

  • Clicking the “Paste” item in the selection context menu.

  • Using the “Paste Special” dialog invoked by clicking the Paste Special… item in the same context menu.

  • Pressing the Ctrl+V or Shift+Insert key combination.

You can provide an additional end-user option for pasting the clipboard’s content into the active worksheet by linking the PasteSelection command to an element of your UI either manually or by using the automatic Ribbon or Toolbar UI generation functionality.

Refer to the Clipboard Operations topic for detailed information on the Spreadsheet/Report Designer control’s clipboard-related functionality, including the full list of supported clipboard data formats, current technical limitations, end-user options and Paste Special settings.

Note

Calling the PasteFromClipboard procedure has no effect if the CanPasteFromClipboard function returns False.

See Also