Forum


Replies: 8   Views: 4304
Add a pager in the footer
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 intphpdocx  · 05-07-2013 - 21:50

You can insert the WordML for NUMPAGES.




$footer_html = "This is some text or html for the footer. Page PAGE_NUM of TOTAL_PAGES";
$footer = $docx->embedHTML($footer_html, array('rawWordML' => true, 'target' => 'defaultFooter'));
$footer = str_replace('PAGE_NUM', '', $footer);
$footer = str_replace('TOTAL_PAGES', '', $footer);
$footer_fragment = $docx->createWordMLFragment(array($footer));
$docx->addFooter(array('default' => $footer_fragment));