Hi,
I'm developing an Add-In in C# for Word 2007 using VSTO for VS2005.
Part of the excercise is to monitor pictures on disk that have been
linked into a word document as an inlineshapes collection. Once a
picture file is being changed by a picture editor then the Add-In
needs to update the document with the revised image. To that end I've
used the FileSystemWatcher object, set it to monitor fileextensions
and the path with the concerned pictures. In the corresponding
OnChange eventhandler I issue the call
Word.Document doc =
Globals.ThisAddIn.Application.ActiveDocument;
doc.Fields.Update()
There are other properties of the document that also need to change
such as bookmark names. Trying to do that in the OnChange function
generates an error usually along the lines that "the object is locked
for format changes".
Does anyone know how to get around this? For the
FileSystemWatcherObject I have set its SynchronizingObject = this,
i.e. assigned it to the C# Add-In usercontrol.
Many thanks for any suggestions,
Rob
Jezebel - 19 Feb 2007 20:57 GMT
If the pictures are linked, you don't need to do anything to the Word
document: it will update automatically next time you open it.
> Hi,
> I'm developing an Add-In in C# for Word 2007 using VSTO for VS2005.
[quoted text clipped - 22 lines]
>
> Rob
robert@oeffner.net - 27 Feb 2007 17:06 GMT
OK I seem to have circumvented the problem now. For my task it's
important that the inlineshape pictures are updated instantaneously.
So having to reopen the document was no good. Trying simultaneously to
update bookmarks proved to be a nightmare since deleting a bookmark
programmatically Word also deletes the object encapsulated by the
bookmark (I find that counterintuitive).
rob
> If the pictures are linked, you don't need to do anything to the Word
> document: it will update automatically next time you open it.
[quoted text clipped - 31 lines]
>
> - Show quoted text -