Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programatically change the layout of a Word 2010 document?

Tags:

c#

.net

ms-word

We have an application that reads Word documents and imports them into our file format.

A recent bug was found that the page count is only available in Page Layout View, however Word 2010 defaults to Web Layout.

Using .NET c# how can we change the view to give us back the page count?

like image 864
Phil Hannent Avatar asked Jan 21 '23 23:01

Phil Hannent


1 Answers

I believe the property you are looking for is Document.ActiveWindow.View.Type = wdPrintView; You can read more in this on MSDN.

like image 197
Lazarus Avatar answered Jan 23 '23 13:01

Lazarus