none
Tracking Content use in Word. RRS feed

  • Question

  • Hello everyone,

    I am planning on developing a tool to log the history of content used in Microsoft Word, accross documents. I already know that is possible to listen for save,open and close events from microsoft word in a .net environment.

    My questions are:

    1. is it also possible to create events for copy and paste actions performed in word, with the copy action being possibly performed in other applications?
    2. does microsoft word keep versions in between saved states, which one could request to analyze the differences made by the user?

    In general I would be happy to follow up any literature that you can point me to with the topics of .net programming around microsoft word.

    Thanks for any help in advance, it is highly appreciated.

    Wednesday, November 30, 2011 9:55 PM

All replies

  • Which version of Word are we talking about?
    Cindy Meister, VSTO/Word MVP
    Wednesday, November 30, 2011 11:27 PM
    Moderator
  • 2007 or later.

     

    Thanks for the quick reply.
    Thursday, December 1, 2011 5:45 AM
  • Hi Rinmic

    It's not possible to create events for any of these things. But using a Ribbon customization (must be part of an Add-in running in-process with the Word application) you can repurpose the commands so that they run your code rather than built-in code. I think that's as close as you're going to be able to get as far as copy/paste go.

    Word 2010 does retain some version information, but I don't know how closely linked this is to "save" calls. 2007 definitely has nothing like this. Nor is it really possible to "read" the Undo list.

    Theoretically, you could, as part of every call to Save or Save As, pick up the WordOpenXML of the file, store that, and use it to make comparisons.


    Cindy Meister, VSTO/Word MVP
    Thursday, December 1, 2011 6:26 PM
    Moderator
  • Hi Cindy,

    many thanks for the quick reply, I will try Ribbon customization :).

     

    Cheers,

    Michael

    Thursday, December 1, 2011 11:11 PM
  • In case someone else tries to do similar things, I found out that it is possible to reorganize the undo stack:

    http://code.msdn.microsoft.com/windowsdesktop/Word-2010-Work-with-the-3449abbc

     

    so far I did not find a way to actually read the single actions.

     

    Cheers,

    Michael


    • Edited by Rinmic Wednesday, December 14, 2011 9:35 PM
    Wednesday, December 14, 2011 9:17 PM
  • At least from Word, couldn't a global template with the following two macros and of course modified to log what was being copied/pasted meet your needs?

    Sub EditCopy()
    '
    ' EditCopy Macro
    ' Copies the selection and puts it on the Clipboard
    '
        Selection.Copy
    End Sub
    Sub EditPaste()
    '
    ' EditPaste Macro
    ' Inserts the Clipboard contents at the insertion point
    '
        Selection.Paste
    
    End Sub
    
    

     


    Kind Regards, Rich ... http://greatcirclelearning.com
    Thursday, December 15, 2011 4:37 AM
  • I am not very experienced yet with macros in office or in general :). But if I assume correctly, that this macro would simply allow me to log every copy and paste action, that yes, it would be sufficiant for my needs. I understand I need to create a global template for this, so the user has to pick the actual template to support my software.

    Thank you very much,

    Michael

    Thursday, December 15, 2011 5:45 AM
  • Hi michael

    <<In case someone else tries to do similar things, I found out that it is possible to reorganize the undo stack:>>

    You don't re-organize so much as you're able - in Word 2010 ONLY - to "group" actions into a single Undo command so that the user doesn't see tons of entries such as VBA.Range.


    Cindy Meister, VSTO/Word MVP
    Thursday, December 15, 2011 10:34 AM
    Moderator
  • Hi Rich

    <<At least from Word, couldn't a global template with the following two macros and of course modified to log what was being copied/pasted meet your needs?>>

    How does this differ from a Ribbon customization (repurposing) of the commands? Except that it's older and depracated...


    Cindy Meister, VSTO/Word MVP
    Thursday, December 15, 2011 10:34 AM
    Moderator
  • Hi Rich

    How does this differ from a Ribbon customization (repurposing) of the commands? Except that it's older and depracated...


    Cindy Meister, VSTO/Word MVP

    Hi Cindy,

    I had a milestone birthday this year and many days that's how I feel ... older and depreciated. :-)

    Absoluety, both approaches would work.


    Kind Regards, Rich ... http://greatcirclelearning.com
    Thursday, December 15, 2011 12:12 PM