0
votes

I'm currently developing a VSTO Word Addin for Office 2013. In this Addin it sould be possible to open a document from the filesystem. I use this codesnippet to do this:

     Word.Document doc = this.Application.Documents.Open(FilePath, ReadOnly: false, AddToRecentFiles: false);
     doc.ActiveWindow.View.Type = Word.WdViewType.wdPrintView;

Now my question, how it is possible to open the Document in the current Window? When i use the codesnippet above Word closes the activeWindow and open a new one.

1

1 Answers

0
votes

If I understood your question correctly, you want to know How the existing file (Active document) closed and the new document is opened.

If that is correct, Below code

Word.Document doc = this.Application.Documents.Open(FilePath, ReadOnly: false, AddToRecentFiles: false);

Declared "doc" object is MSword application itself. since It closed the existing one and opened the new document.