Text changes in Word

M

Mick

I'm attempting to use VSTO to do some heavy logging in Word. I'm trying to
find a way to detect any changes (text, formatting, inserts, the lot) to the
document. I have tried using the XMLAfterInsert event but I'm unclear as to
when this fires - when xml is inserted into the .docx file or actual xml is
inserted into the document? So far I haven't been able to get this event to
fire just by manipulating the document through the Word application UI.

Can someone enlighten me as to what actually makes XMLAfterInsert fire, and
if there is an event that is fired every time the content of the document is
changed?

Cheers,

Mick
 
C

Cindy M.

Hi Mick,
I'm attempting to use VSTO to do some heavy logging in Word. I'm trying to
find a way to detect any changes (text, formatting, inserts, the lot) to the
document. I have tried using the XMLAfterInsert event but I'm unclear as to
when this fires - when xml is inserted into the .docx file or actual xml is
inserted into the document? So far I haven't been able to get this event to
fire just by manipulating the document through the Word application UI.

Can someone enlighten me as to what actually makes XMLAfterInsert fire, and
if there is an event that is fired every time the content of the document is
changed?
Start with the last question, since that's really what interests you: No, there
is no event that triggers when the content of a document is changed by the end
-user. The closest you can get to:
- activate Track Changes ("Revisions")
- protect the document for changes, with a password (so that no one can
turn change tracking off)

This will let you gather the information *after the fact*. (You could log
things when the user saves, prints or using a "timer", for example.)

Word wasn't designed for "Big Brother" tasks. If you need to track things as
they happen, then Word is not the right tool. Theoretically, using the Windows
API you could probably pick up a lot of things, but very little of what you
want is part of the object model.

The XML command in question is only relevant if XML nodes from an attached
schema are being inserted into the document. As the Help topic says, it fires
when an XML element (node) is being embedded.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top