Solved

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

Posted on 2014-10-13
1
169 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 48

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now