Detecting a pasting event

Posted by: pita1208 on 8 September 2017, 2:38 pm EST

  • Posted 8 September 2017, 2:38 pm EST

    Hi,


     I'm trying to detect when the user pastes something into the spread, so I can display a message box while the pasting occurs until it is done so the user doesnt think the system is hanging, etc. - is there an event I can look for?


     


    Thanks.

  • Replied 8 September 2017, 2:38 pm EST

    Hi,

    Version 5 has a ClipboardPasting event which fires before the clipboard paste action, and a ClipboardPasted event which fires afterwards.

  • Replied 8 September 2017, 2:38 pm EST

    The ClipboardPasting event is supported in version 4, but not ClipboardPasted (that was added in v5).  You would need to set AutoClipboard to false and add code to handle the clipboard shortcut keys and call the ClipboardCopy, ClipboardCut, and ClipboardPaste methods, and use ClipboardCutUndoAction and ClipboardPasteUndoAction if you want to support undo/redo.
  • Replied 8 September 2017, 2:38 pm EST

    Hi,


     Thanks so much! Is there documentation on this event so I can look into it some more? I was having a hard time finding it. (I guess what I'm looking for is if there is a way to use it client side in javascript...)


     


    Thanks again!

  • Replied 8 September 2017, 2:38 pm EST

    Hi,

    I was talking about the Spread for Windows Forms control (your post is in the forum about that version of Spread).  If you are using Spread for ASP, please ignore my previous replies; those events are not supported.  You would need to write client script code to attach event handlers to the command bar button for paste and to the key events to handle when the button or Ctrl+V is pressed.  There is a sample which ships with Spread for ASP called PasteExcel which demonstrates how to handle the click on the paste button in the command bar.

  • Replied 8 September 2017, 2:38 pm EST

    Hi,


     I am using the Windows Form control (I know for sure its not Spread for ASP)...I'm just trying to do all the processing on the client side - i dont think theres any need to do anything server side. I want to detect as soon as a user hits Ctrl+V to paste some data from Excel..i want to show a dialog box while data is being pasted into the spread and then close the dialog box once the paste is complete (since for some scenarios the paste takes a while and it may look to the user that nothing is happening).

  • Replied 8 September 2017, 2:38 pm EST

    Hello,

    I just noticed that you have started a new thread for the same forum post in Spread for ASP.Net. Hence we will continue this post for Spread for ASP.Net.

    Thanks.

  • Replied 8 September 2017, 2:38 pm EST

    Hi,


     Thanks for the quick response! Is there any way to do it in version 4?


     

Need extra support?

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

Learn More

Forum Channels