Board index » delphi » Count Number of pages in a MSWord Document

Count Number of pages in a MSWord Document


2006-01-04 12:22:50 AM
delphi48
How can I get the total number of pages in MS Word Document ?
In other words, is there a property like MyTWordDocument.Something.Pages.Count ?
Thank's
Régis CLUSEAU
 
 

Re:Count Number of pages in a MSWord Document

<<Régis CLUSEAU:
How can I get the total number of pages in MS Word Document
?
Quote
>
var
VDoc: OleVariant;
..
VDoc := Word.ActiveDocument;
NumPages :=
VDoc.BuiltInDocumentProperties[wdPropertyPages].Value;
--
Deborah Pate (TeamB) delphi-jedi.org
TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
www.borland.com/newsgroups/genl_faqs.html
 

Re:Count Number of pages in a MSWord Document

Quote
NumPages :=
VDoc.BuiltInDocumentProperties[wdPropertyPages].Value;
This value is not always correct
You may laso try the
Doc.Content.Informartion[wdNumberOfPagesInDocument]
If this will not work too, call the UpdatePageNumbers method for
TableOfContents interface