Clipboard operations refer to actions performed on the temporary storage area known as the clipboard, where data like text, images, or files can be copied, cut, and pasted. The FlexGrid control also supports common clipboard operations. By default, the FlexGrid control allows copying data from cells to any location in the computer and within itself without headers. Along with cell data, sometimes you require row or column headers to be copied. You can easily permit or restrict the copying of headers with cell data using the ClipboardCopyMode property. This property mainly allows you to get or set a value that indicates how content is copied to the clipboard. The ClipboardCopyMode property is of type GridClipboardCopyMode (.NET) / ClipboardCopyMode (.NET Framework) enum, which provides the following options that can be used during the copying operation:
Options | Description |
None | Disables the clipboard support. |
ExcludeHeader | Enables users to copy only the text values of selected cells to the Clipboard without the values of row and column header. |
IncludeColumnHeaders | Enables users to copy the text values of selected cells to the Clipboard along with the values of column header. |
IncludeRowHeaders | Enables users to copy the text values of selected cells to the Clipboard along with the values of row header. |
IncludeAllHeaders | Allows users to copy the text values of selected cells to the Clipboard along with the values of row and column header. |
Default | Enables copying the data to the clipboard allowing final users to decide whether it needs the headers or not. It provides Copy with Headers option in the context menu for this purpose. This option is available in .NET only. |
DataOnly | Allows users to copy the selected data only. This option is available in .NET only. |
DataAndColumnHeaders | Allows copying of the selected data along with the column headers. This option is available in .NET only. |
DataAndRowHeaders | Allows copying of the selected data along with the row headers. This option is available in .NET only. |
DataAndAllHeaders | Allows copying of the selected data along with all row and column headers. This option is available in .NET only. |
You can implement the above-mentioned clipboard operations on various types of selected ranges within the grid. These selected ranges could be contiguous, like row range, column range, or non-contiguous, like multi-range. For non-contiguous selection ranges like multi-range, the selected range must lie within a common row or column range.
On the basis of the ClipboardCopyMode property options, below clipboard operations can be performed on the FlexGrid control. The availability of these operations varies in the selection menu or context menu on the basis of the values set through the ClipboardCopyMode property. The names of operations and their corresponding shortcut keys are as follows:
Operations | Shortcut keys |
Select All | Ctrl+A |
Cut | Ctrl+X |
Copy | Ctrl+C |
Copy with Headers | Ctrl+Shift+C |
Paste | Ctrl+V |
Delete | Del |
Undo | Esc |
Following code example shows how you can set the ClipboardCopyMode property for the FlexGrid control. This example uses the sample used in Quick Start topic.