ClipboardPasted event to call Change event after text is pasted from clipboard

Posted by: abhishek1991rana on 25 March 2019, 12:49 am EST

    • Post Options:
    • Link

    Posted 25 March 2019, 12:49 am EST

    Hello,

    i am working on the following scenario and need the suggestions as i am new to spreadsheet:

    When i copy(ctrl+c) and paste(ctrl+v) any content it in a spreadsheet cell, i want the “Change” event to be called automatically which is not happening currently.

    For the copy paste event i am using the “ClipboardPasted” event. The code is as following:

    this.sprdRoomBed.ClipboardPasted += new FarPoint.Win.Spread.ClipboardPastedEventHandler(this.sprdRoomBed_ClipPasted);
    
            private void sprdRoomBed_ClipPasted(object eventSender, ClipboardPastedEventArgs eventArgs)
            {
                FourFiveEvents.CopyClipPasted();
             }
    
     public void CopyClipPasted()
            {
                DefRoomBed.Spreadsheet_pasted();
            }
    
     public void Spreadsheet_pasted()
            {
                mForm.cmdApply.Enabled = true;  //Enable the cmdApply button once data is pasted from the clipboard to a data cell in spreadsheet.
             }
    

    In my application there exist a “Change” event which gets triggered when i type some text in the spreadsheet data cell but the “Change” event is not getting triggered when i copy paste the content in the spreadsheet data cell.

    Please Help!!

    Abhishek Rana

  • Posted 26 March 2019, 4:38 pm EST

    Hi Abhishek,

    There is no direct event which only fires for changes in the cell (including changes due to copy-paste operation). However, you can use SheetView.CellChanged event and check if this event was fired because of a Paste operation (by using a boolean flag which is set in ClipboardPasting event).

    Please refer to the attached sample to see how you can do it.

    Regards,

    Jitender

    ClipboardChangeEvent.zip

Need extra support?

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

Learn More

Forum Channels