0
votes

I am currently opening a word document using System.Diagnostics.Process.Start(Filename). However, the word document requires to automatically open in a web layout. (this is an option when selecting view and Web Layout in MS Word)

Is there a way to do this with the current method I am using to open this?

1
There's no way to change the layout directly using Process.Start. If the file was saved when last closed in this layout it will open automatically in the layout. That means you could write it into the file's Open XML before opening it in Word. Otherwise you need to use the "Interop" (Word.Application wdApp = new Word.Application();), then you can control the Word environment. - Cindy Meister

1 Answers

2
votes

You can set by below code imp is WdViewType.wdWebView

  using Word = Microsoft.Office.Interop.Word;
  Word.Application wordApplication = new Word.Application();
 var path="fullpath of docuent"
                 wordApplication.Documents.Open(path);
                wordApplication.Visible = true;
                wordApplication.ActiveWindow.View.Type = WdViewType.wdWebView;
                ;