?
Solved

How to find numebr of pages in word document using c#

Posted on 2014-10-13
1
Medium Priority
?
187 Views
Last Modified: 2014-10-14
How to find numebr of pages in word document using c#
0
Comment
Question by:mannevenu26
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40376793
Hi,

pls try

using System;
using Microsoft.Office.Interop.Word;

class Program
{
    static void Main()
    {
        // Open a doc file.
        object oMissing = System.Reflection.Missing.Value;

        Application application = new Application();
        application.Visible = true;
        Document document = application.Documents.Open("c:\\YourFile.docx");
        long lngPageCount = document.ComputeStatistics(Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages, oMissing);         
        Console.WriteLine("Pages {0} ", lngPageCount);

        application.Quit();
    }
}

Open in new window


Regards
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question