Displaying Word Documents Within C# Forms


  • Hi everyone.

    In our project, We have the following scenario: We create Word 2003 XML documents on the fly from certain data, And present this document to the user for preview in the following way - A form containing an AxBrowser control is loaded (basically wraps the IE engine unless im wrong) and we navigate that control to the location where the .xml sits. Now, With word 2003 and the registry value EditFlags set-up correctly, The control does successfully render the document inside it.

    Lately, We have been testing word 12 out to see if it fits us and migrating does not hurt current business logic, And we were unable to mimic this behavior - The class Word.Document.12 does not contain the same registry value and the document, When navigated in the browser control by code, Simply lauches a word window instead.

    Is there a way to return this behavior to the way it was before, And if not, Is there a better way to display word documents inside C# applications?

    Thanks in advance.

    Monday, October 16, 2006 12:55 PM


  • Did you try setting BrowserFlags for Word.Document.12 as well?

    @="Microsoft Office Word Document"

    Tuesday, November 28, 2006 1:47 AM

All replies

  • Your not getting any response here, so I'm moving this to Visual Studio Tools for Office. Maybe someone there can help you.


    - Charlie

    Wednesday, October 18, 2006 6:05 AM
  • Thanks. I might have solved it in the process, Not too sure, So i'll wait for an answer.

    We saw similar solutions relating to setting the 'BrowserFlags' registry key to 0x0 to enable in-browser rendering and setting it to 0x8 to disable. There is no documentation on this key and its possible values, So im not sure if this hurts our process in any way.

    Wednesday, October 18, 2006 10:13 AM
  • Not sure this helps, but here's a link to displaying WordML documents in IE

    Word 2003: XML Viewer

    Wednesday, October 18, 2006 2:47 PM
  • I firmly believe that setting BrowserFlags to 0x24 is the correct value that provides in-browser behavior. Again, I was not able to find any documentation about this - but I remember this setting from the time when I investigated how IE hosts Word/Excel.
    Thursday, October 19, 2006 5:52 AM
  • I will try 0x24 and see how it behaves, Though i find it odd there's not even the slightest of documentation on this. I've marked your post as the answer for this thread, Thanks :)
    Thursday, October 19, 2006 6:55 AM
  • Well, I'm back. We've obtained Office 2007 Enterprise at work and i tried this method again. I still cannot get IE to host the new word documents properly.

    Any help on this matter will be greatly appriciated.

    Sunday, November 26, 2006 10:33 AM
  • Did you try setting BrowserFlags for Word.Document.12 as well?

    @="Microsoft Office Word Document"

    Tuesday, November 28, 2006 1:47 AM
  • I've set that key for both Document.12 and MacroEnabledDocument.12 and restarted. For some reason, Now it did give the currect effect (though only in RTM, pre-release versions seemed to ignore my values more or less). I'll make some tests on non-development enviroments and see further.

    Thanks for the quick response.

    Tuesday, November 28, 2006 7:25 AM