WinUI | ComponentOne
Controls / FlexGrid / Clipboard Support
In This Topic
    Clipboard Support
    In This Topic

    FlexGrid provides comprehensive clipboard functionalities. It includes customizable copy options in the grid, allowing end-users to copy sections of data with or without headers and to selectively copy specific data subsets with headers for efficient data extraction. FlexGrid provides the ClipboardCopyMode property which allows you to choose which part of the selected content to copy out of row header, column header and data by using GridClipboardCopyMode enumeration. It defines the following constants that specify whether users can copy data from the FlexGrid control to the clipboard and whether column and row header values are included.

    Enumeration values Description
    DataAndAllHeaders

    Copies the selected data and includes all row and column headers.

    DataAndColumnHeaders Copies the selected data and includes only the column headers.
    DataAndRowHeaders Copies the selected data and includes only the row headers.
    DataOnly Copies only the selected data and no headers.
    Default Copies the data to the clipboard allowing final users to decide whether it needs the headers or not.
    None Does not copy any data to the clipboard.

    Note that the copy operation does not support merged cells within the grid. When a datamap or multicolumn combo box exists in the copied range, only the display value is copied. Moreover, the hidden cells are copied when copying a cell range.

    FlexGrid provides flexibility to perform various clipboard operations such as cut, copy and paste on the editable grid data through keyboard shortcut keys along with some other operations. The shortcut keys for the supported clipboard and other operations are listed in the following table:

    Operations Keystroke Purpose
    Select All Ctrl+A Selects the text.
    Copy Ctrl+C Copies the selected text.
    Copy with Headers Ctrl+Shift+C Copies data with headers.
    Cut Ctrl+X Cuts the selected text.
    Paste Ctrl+V Pastes the copied text.
    Delete Del/delete Deletes the selected text.

    The following code showcases the use of ClipboardCopyMode property. This example refers the Quick Start sample. Note that the items appearing in the selection menu at runtime depends on the GridClipboardCopyMode enumeration value set for the ClipboardCopyMode property.

    <c1:FlexGrid Name="flexGrid1" ClipboardCopyMode="IncludeAllHeaders" SelectionMode="MultiRange"/>
    
    flexGrid1.ClipboardCopyMode = ClipboardCopyMode.IncludeAllHeaders;