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
Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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