Forum


Replies: 1   Views: 2951
How to add pageof in document body?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin@intuswindows.com  · 25-10-2016 - 17:28

Hi, how can i add pageof in document body inplace some variable instead header/footer.

When i try to replaceVariableByWordFragment, variable was replaced by "page 1 of 1" in more than 1 page document :(

In footer/header works fine, but i want to put pageof in different places on some pages.

Posted by admin  · 25-10-2016 - 18:13

Hello,

Word has some limitations when adding content that must be autoupdated outside header and footer contents. And it may require pressing F9 to update it.
We recommend you to use headers or footers for this kind of content.

You also can use a template instead of the default empty document. You can create a DOCX that include the numbering, and use it as a template (using the CreateDocxFromTemplate class) adding new content and replace existing placeholders.

Or you can use the addSimpleField method to get the number of pages:

http://www.phpdocx.com/api-documentation/word-content/add-a-field-to-the-Word-document

Regards.