Clipboard Operations
- 2 minutes to read
Data displayed within a View can be copied to the clipboard if the DataViewBase.ClipboardCopyAllowed property is set to true. Views provide multiple methods, allowing you to copy cell values displayed within selected or individual rows. End-users can only copy text displayed within selected rows or cells.
#Copying Data
Row values are copied to the clipboard as text. Only the contents of visible columns are copied. For group rows, only the values of the grouping columns are copied (group summary values are not copied). Hidden rows, contained within collapsed group rows, are not included. If the DataViewBase.ClipboardCopyWithHeaders option is enabled, column captions are also copied to the clipboard.
Rows in the clipboard are separated by newline strings ("\r\n"). The TAB character ("\t") is used to separate cell values within a row.
To copy row data in code, use the following methods.
Method | Description |
---|---|
Data |
Copies values displayed within specified rows to the clipboard. |
Data |
Copies values displayed within a specified range of rows to the clipboard. |
Data |
Copies the display values of selected rows to the clipboard. |
Data |
Copies values displayed within the focused row to the clipboard. |
Data |
Copies values displayed within selected row |
Table |
Copies the values displayed within specified cells to the clipboard. |
Table |
Copies values displayed within selected cells to the clipboard. |
End-users can copy selected rows using Ctrl+C or Ctrl+Ins. The focused row is always copied, regardless of its selected state.
#Processing Clipboard Operations
Views provide two events that allow you to manually process clipboard operations. The GridViewBase.CopyingToClipboard event is fired before row values are copied to the clipboard by an end-user or in code. The DataViewBase.PastingFromClipboard event is fired after an end-user has pressed Ctrl+V or Shift+Ins.
#Example: How to Process Data Copying
NOTE
The Grid
The DataViewBase.PastingFromClipboard event can be handled if you want to implement data pasting.