Determine page count from Word Doc File

M

m rafala

Is there a way to programmatically determine the page count from a Word Doc
file without opening it in Word and without using a COM object (and without
requiring Word be installed)?

I can do this with an RTF file by simply reading in the plain text and
looking for the {\nofpages#} tag. But I would like to do this for a binary
Doc file as well.
 
J

Jay Freedman

m said:
Is there a way to programmatically determine the page count from a
Word Doc file without opening it in Word and without using a COM
object (and without requiring Word be installed)?

I can do this with an RTF file by simply reading in the plain text and
looking for the {\nofpages#} tag. But I would like to do this for a
binary Doc file as well.

No. Word doesn't know or care about or store the number of pages into the
document file. That number varies continuously as the repagination engine
runs, taking information from the currently selected printer driver. To get
the number, you must run Word.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
M

m rafala

Excellent, Thanks. This is what I suspected. Your response is what I need to
convince the boss to accept Plan B.

But I was surprised to see that the RTF file does indeed contain the page
count in nofpage# tag.
 

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