I have a word document,now,I want to get number of pages in a Word document.What the phpword function can I use?
There is no function to get the current page number. The only way is to use "addPreserveText" like:
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.');
The documents you are programming with phpword are declarative. So you declare how the document should be structured and then an application, like Mircosoft Word, creates a view of this declaration.
When you add content like a textrun with a text that is two pages long, phpword doesn't programmatically know anything about the length.
Thank you very much.
Most helpful comment
There is no function to get the current page number. The only way is to use "addPreserveText" like:
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.');
The documents you are programming with phpword are declarative. So you declare how the document should be structured and then an application, like Mircosoft Word, creates a view of this declaration.
When you add content like a textrun with a text that is two pages long, phpword doesn't programmatically know anything about the length.