Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Problem updating word document from and Add-In

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
robert@oeffner.net - 19 Feb 2007 18:07 GMT
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 -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.