We are experiencing a problem with the Office Viewer component. We are using it embedded in a browser window (IE7). It is exhibiting some strange behavior under certain conditions.

These are the steps to reproduce:

If you open the browser window that has an instance of the office viewer on it, and use javascript to have the Office viewer open a word document
Have another instance of WORD open in “stand alone” mode and minimize it to the windows toolbar
While the first browser window is opening and loading the WORD document, press on the WORD toolbar icon, so it maximizes and displays on the desktop

If you get the timing exactly right, so you open the minimized document just before the browser embedded version of WORD paints itself, what you get is the two WORD documents are switched. The browser window displays the document that was in the minimized copy of WORD, and the stand alone version of WORD displays the document that should have been displayed in the browser instance.

The automation interface is still manipulating the correct document, even though the document is opened in the wrong container. For example, if you print the document using javascript in the browser, the document that gets printed is the one in the other window.

Have you ever come across this phenomenon?

I tried again, making absolutely sure that it was 7.5.0.331 installed, as you suggested. It is still happening. It is important that you follow the sequence precisely….if you open word before you open the OfficeViewer demo app then everything is OK. If you follow the following steps, it should occur:

1) Reboot your machine

2) Start the OfficeViewer HTML demo app by double clicking on officeviewer.htm in the samples folder. Enable the OCX by choosing: “allow blocked content”

3) Open an existing WORD document in the OfficeViewer App

4) Open a stand alone instance of word, and type a sentence in it.

5) Choose the “close doc” option on the OfficeViewer.htm menu. When the doc closes, instead of seeing an “empty” instance of WORD, you see the “blank” page. This is how you can tell it is going to happen. If you try the next test below, after hitting “Close doc” you will still see there is still an instance of word present with the toolbar, but no document..

6) Close the browser window (using the x). the stand alone instance of WORD will close, along with the browser window.

Clearly, in the above example, what has happened is the OfficeViewer has gotten mixed up, and is internally pointing to the stand alone instance of WORD, instead of the instance of word it was housing. So when the browser window closed, it shut down WORD as well.

If you try the following sequence, you will not see the stand alone instance of Office close:

Test 2:

1) Reboot your machine

2) Open a stand alone instance of word and minimize it to the task bar

3) Start the OfficeViewer HTML demo app by double clicking on officeviewer.htm in the samples folder. Enable the OCX by cohoosing: “allow blocked content”

4) Open an existing WORD document in the OffiveViewer App

5) Open a stand alone instance of word, and type a sentence in it.

6) Choose the “close doc” option on the OfficeViewer.htm menu. When the doc closes, unlike in the test above, you will still see WORD open with its toolbar, but no document.

7) Close the browser window (using the x). the browser window will close, but the stand alone instance of WORD will stay open

Clearly, having an instance of WORD open before you instantiate the OfficeViewer seems to keep the instance pointers correct. In fact, in some situations, “windowless” WINWORD.EXE processes are left running by OfficeViewer, and if one of those is running, then the problem will not occur. In fact, one of the possible work arounds I have considered is to actually start a copy of WINWORD.EXE if there is not one currently running…

Test 3:

After doing test 2, close both instances of WORD, and re-try test 1, without doing the reboot. Everything works correctly. As far as I can tell, once it works “correctly” it won’t happen again.

This is very reproducible on all of our corporate machines. Would it be possible for you to try again, following those instructions exactly? If you are absolutely sure it is not happening on your environments, then I will have to start looking at our machine configs….but I could literally spend weeks on it, and if it turns out that it in fact is happening on your machines as well, then it would be totally wasted time. So I would really appreciate it if you could try again, following that precise sequence above…it could same me hundreds of hours of effort!