Solved

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

Posted on 2014-10-13
1
183 Views
Last Modified: 2014-10-14
How to find numebr of pages in word document using c#
0
Comment
Question by:mannevenu26
1 Comment
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 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