Customizing copy and paste for in cell editing

Posted by: crmfusiongw on 8 September 2017, 3:00 pm EST

  • Posted 8 September 2017, 3:00 pm EST

    For may reasons I have had to create my own cut an past for my spreadsheet.  This works great when I am cutting, copying and pasting a selection of columns into and out of the clipboard.

    I am having issues on how to handle cutting a portion of text that is selected inside a single cell when it is being edited.  For example,  If the user selects 2 rows and 5 columns and hits copy I intercept the CTL-C and run my own routine to copy the data into the clipboard.  I'm at a loss in handling the situation where a user double clicks inside a cell and then selects a portion of that text and hits CTL-C

    Any help would be greatly appreciated.


  • Replied 8 September 2017, 3:00 pm EST


    When in edit mode, you can use the EditingControl property in the FpSpread class (and SpreadView class) to get the cell editor control. The type of editor control will depend on the cell type. The GeneralCellType uses GeneralEditor. The GeneralEditor has a SelectedText property for getting/setting the selected text. For GeneralCellType cells, the code for clipboard copy might look something like the following...


    if (fpSpread1.EditMode)
        Control control = fpSpread1.EditingControl;
        if (control is GeneralEditor)
                GeneralEditor editor = (GeneralEditor)control;
                string text = editor.SelectedText;
                ... // put text on clipboard

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels