none
How to get width, height and orientation of each page in word document using C# RRS feed

  • Question

  • I need to findout width, Height and orientation of each page in word document using C#. Please help me.

    F a i r L i g h t

    Monday, October 27, 2014 9:42 AM

Answers

  • Application.ActiveDocument.PageSetup
    • Marked as answer by FairLight Monday, October 27, 2014 9:59 AM
    Monday, October 27, 2014 9:58 AM
  • got the answer.

    http://stackoverflow.com/questions/17382755/read-ms-word-file-page-by-page

    we need to enumerate each page using goto command and then get Dimensions using

    doc.ActiveWindow.Selection.PageSetup


    F a i r L i g h t


    • Edited by FairLight Monday, October 27, 2014 10:02 AM
    • Marked as answer by FairLight Monday, October 27, 2014 10:02 AM
    Monday, October 27, 2014 9:59 AM

All replies

  • Application.ActiveDocument.PageSetup
    • Marked as answer by FairLight Monday, October 27, 2014 9:59 AM
    Monday, October 27, 2014 9:58 AM
  • got the answer.

    http://stackoverflow.com/questions/17382755/read-ms-word-file-page-by-page

    we need to enumerate each page using goto command and then get Dimensions using

    doc.ActiveWindow.Selection.PageSetup


    F a i r L i g h t


    • Edited by FairLight Monday, October 27, 2014 10:02 AM
    • Marked as answer by FairLight Monday, October 27, 2014 10:02 AM
    Monday, October 27, 2014 9:59 AM
  • VSTO doesn't provide anything for that.

    I'd suggest asking such question on the Word for Developers forum instead. Try to take a look at the Information property of the Range class.

    Monday, October 27, 2014 10:09 AM
  • We can buddy,

    We can get PageCount using following code

    WdStatistic stat=WdStatistic.wsStatisticPages;

    int pagecount=doc.ComputeStatistics(stat,Missing);

    Then Enumerate page using PageCount and  Goto statement

    to reference first page we must put last parameter of Goto statement as 1 like wise for second page it must be 2

    and then when we fetch property value of doc.ActiveWindow.Selection.PageSetup then you get height and width information.

    orientation can be found. I saw code some where on MSDN to fetch it.


    F a i r L i g h t

    Monday, October 27, 2014 10:38 AM
  • We need to create Document object using (Application).Documents.Open method

    F a i r L i g h t

    Monday, October 27, 2014 10:43 AM