Hello,
The example Core/addPageNumber/sample_1.php adds a page number that is updated automatically when the DOCX opens. If you try to do the same in the body you need to update it manually; you can read this explained on the API page:
https://www.phpdocx.com/api-documentation/word-content/insert-page-number-Word-document-with-PHP
If the page number is not added to a header or footer the user may need to press F9 in the MS Word interface to update its value to the current page.
In our previous reply, we meant that other fields, such as page number, are updated automatically when they are added to headers or footers, but this doesn't happen in all cases. This is a limitation from MS Word and we can't avoid it.
We recommend you to use a macro to update fields automatically:
https://groups.google.com/forum/#!topic/microsoft.public.word.numbering/yUNIqiEvjLw
http://www.gmayor.com/installing_macro.htm
There're events that can run macros automatically such as AutoOpen; on the previous page you can read more information about these events.
Regards.