Need Page Count Code Urgently

  • Thread starter Scott Bellware [C# MVP]
  • Start date
S

Scott Bellware [C# MVP]

I really need to find a .NET code snippet that will give me the page count
for the current document. I'm not a master with the arcane arts of legacy
Office COM API's and I'm affraid I need a bit more guidance than RTFM, unless
you can point me to the FM (I can't seem to find the stuff I need on MSDN...
not even by googling!).

If anyone can help, I'd be pretty darned appreciative. I'll name my third
child after you even!

Thanks, y'all!

Scott Bellware
C# MVP
www.bellware.net
 
P

Peter Jausovec

Hi Scott,

You can use the following code to get page count:

Word.ApplicationClass word = new Word.ApplicationClass ();
Word.Document doc = word.Documents.Open (...);
//
Word.WdStatistic stat = Word.WdStatistic.wdStatisticPages ;
int num = doc.ComputeStatistics(stat,ref missing);


Hope this helps.
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Scott Bellware [C# MVP]" <[email protected]> je
napisal v sporoèilo ....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top