Notification on clipboard paste in Office 2010/2013

Add-in Express™ Support Service
That's what is more important than anything else

Notification on clipboard paste in Office 2010/2013
 
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi,

I need to intercept when user pastes something into an Office document.
This means intercepting all possible ways of pasting like Ctrl+V, menus, toolbars, ribbons, special paste...

All I need is to get a callback when paste occurred, so I can modify the document...

I know how to intercept keyboard shortcuts, I need help with all other controls including Paste Special, etc...
Posted 09 Apr, 2014 10:14:10 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Igor,

What Office application(s)?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Apr, 2014 02:20:34 Top
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi Andrei,

Excel, word and powerpoint
only 2010 and 2013

Thanks.
Posted 10 Apr, 2014 04:05:35 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Igor,

You can use a number of Ribbon Command components to intercept all variations of pasting. Still there's a problem, you cannot intercept choosing a paste special type from the gallery (IdMso="PasteGallery") in the context menu.

You can find out however that such a paste was performed and undo it. Please check http://social.msdn.microsoft.com/Forums/en-US/e544ac54-b49f-4bf1-9ccc-719ae64cd5f3/trap-event-for-cutpaste-of-cells-using-interop-c?forum=exceldev.


Andrei Smolin
Add-in Express Team Leader
Posted 10 Apr, 2014 06:56:10 Top
Igor Govorov




Posts: 83
Joined: 2014-02-12
Hi Andrei,

Thanks,
So I understand that there is a deterministic way to find out that special paste was performed, I only need a notification right before or after the actual paste action, I don't need to undo it.

Can the solution in the link can be used also in word and powerpoint special paste?


Regards,
Igor
Posted 10 Apr, 2014 09:46:28 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Igor Govorov writes:
So I understand that there is a deterministic way to find out that special paste was performed,


Exactly.

Igor Govorov writes:
Can the solution in the link can be used also in word and powerpoint special paste?


As far as I know, yes, you can use the same approach in Word and PowerPoint. In fact, I believe the same approach can be used in all Office applications except for Outlook 2013: it doesn't have any command bar controls.


Andrei Smolin
Add-in Express Team Leader
Posted 10 Apr, 2014 10:25:50 Top