none
MS Word not showing document when loaded by Interop from .NET application RRS feed

  • Question

  • I am working on an application that populates data into successive tables in MS Word via Interop.

    There is a problem with MS Word as when I make it visible using `oWord.visible=true` although I can see the Word window and the ribbon I can not see the document.

    here is a picture (there should be a document there, but it only shows the background):

    What can I do to resolve this, I have tried to repair it, and when I open Word seperately from the Start menu there is no problem even viewing the same Word template.

    It is a Word 2003 document veing controlled using via Word 2010 Interop

    What can I do about this - is there some Interop assembly I need to re-install or something? I have tried installing SP2 to see if that would doa  refresh of the libraries, plus restarted...

    thanks

    Monday, June 30, 2014 7:01 PM

All replies

  • Hello Man,

    It looks like the issue depends on your code. You need to release the message loop of the Word window procedure to let it re-draw itself.

    Did you try to debug the code? What line of code causes the issue?

    Monday, June 30, 2014 8:18 PM
  • Hi,

    I suggest you creating a simple sample to confirm whether this issue is realte to the code. You can write several lines of code to open an existing Word document in the sample.

    If you can reproduce this issue, it may relate to the enviroment. I suggest you uninstall the Office application, Visual Studio and .Net frameword and reinstall in to see whether this issue was resolved.

    If this issue is relate to the code, to narrow down this issue, I suggest you commenting some lines of code each time when you debuging until find the specific line of code causeing this issue. If you still have problem, you can post the full code sample to helpus to reproduce this issue.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 1, 2014 6:57 AM
    Moderator
  • hi,

    it's after creating an instance of MS Word through .NET InterOp in c#.

    strange thing is, the other types of documents don't have this problem, it only appears on 2 specific word templates. I tried opening them from another pc and they show up fine.

    Tuesday, July 1, 2014 12:33 PM
  • There's something strange about your screen shot: The keyboard shortcuts are displaying for the Ribbon, which means the Alt key was pressed? That could inhibit screen redrawing...

    FWIW, when I run VBA code I can always see what's happening in a document (unless I've deactivated ScreenUpdating), but not necessarily when .NET Framework code is running. Once it's finished, then yes, I should see the document.

    Have you tried explicitly calling ScreenRefresh to force a redraw?


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, July 1, 2014 2:44 PM
    Moderator