none
How to track word processes completion like re-pagination, spell checking? RRS feed

  • Question

  • Hi Everyone,

    I am working on one Word 2007 Add-in project in C# using VSTO. I want to track the completion of some Word UI events like Re-pagination, Spell checking etc. I have some code that should execute once these processes gets completed. Otherwise my word page screen is getting stuck and giving unexpected results.

    Please let me know, if anyone has any ideas for that.

    Thanks,


    Shahab Abbasi

    Thursday, October 17, 2013 3:02 PM

Answers

  • Hi Shahab

    I'm afraid there are no events that correspond to these processes in Word.

    The closest I can think of would be to try the DocumentBeforeSave event. Send a Save or SaveAs command to Word for the Document object. The event will fire before  the save takes place and saving can be cancelled during the event. It's possible that the event won't trigger before the background actions complete. You'll have to test and see...


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, October 17, 2013 4:48 PM
    Moderator

All replies

  • Hi Shahab

    I'm afraid there are no events that correspond to these processes in Word.

    The closest I can think of would be to try the DocumentBeforeSave event. Send a Save or SaveAs command to Word for the Document object. The event will fire before  the save takes place and saving can be cancelled during the event. It's possible that the event won't trigger before the background actions complete. You'll have to test and see...


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, October 17, 2013 4:48 PM
    Moderator
  • Thanks for the reply Cindy,

    Actually i am very much frustrated with the behavior of the Word API. Programmatically, i am putting some bookmarks on certain word paragraphs ranges. When the document size is large and after immediate completion of this event, if i tried to get the bookmark ranges based on bookmark names, then i am getting some unexpected ranges at some bookmarks. When i save the document, close it and opening it again, then i am getting the perfect ranges from the bookmarks. Don't know, what is causing this issue? Might be some processes are running in background, calculating something because of that bookmarks doesn't returned the exact bookmark ranges. Programatically Reloading the active document works perfectly but we don't have to save the document programatically, there fore it asks to save the document, which we don't want to do. Is there any other way to update the exact ranges of word bookmarks?

    Thanks,


    Shahab Abbasi

    Friday, October 18, 2013 3:01 PM
  • Hi Shahab

    Since we have no way of knowing how you've constructed this project, and when your code is doing what, it's not possible for us to even venture a guess on why you'd be getting odd results for bookmark ranges. It would also be helpful if we had an example of "unexpected ranges" vs. "perfect ranges", including what kinds of things these ranges include, besides "plain text".


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, October 18, 2013 5:42 PM
    Moderator