Forum


Replies: 8   Views: 4152
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 nicolas  · 05-09-2011 - 12:10

Hi,

I need a more advanced pager in the footer.

Indeed, we can only have the number of the current page, not [b]the total pages of a document[/b].

Moreover, the "pagerAlignment" argument can not be customized. I need to [b]write the number of the current page in a defined place[/b] on the page. The position should be set on the abscissa and ordinate.
I have the same need to write the number of total pages of a document.

So, four args should be addeed:
currentX: position (px)
currentY: position (px)
totalX: position (px)
totalY: position (px)

I am not the only one having this needs, see the comments of the addFooter method: http://www.phpdocx.com/documentation/add_footer_word_document

Best regards,

Posted by admin  · 11-04-2013 - 12:13

Hello,

We're studying how to implement this feature. You can also contact with support to get a custom development.

Regards.

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));

Posted by intphpdocx  · 05-07-2013 - 21:53

The WordML got stripped out, trying again.




$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', '<w:fldSimple w:instr="PAGE"/>', $footer);
$footer = str_replace('TOTAL_PAGES', '<w:fldSimple w:instr="NUMPAGES"/>', $footer);
$footer_fragment = $docx->createWordMLFragment(array($footer));
$docx->addFooter(array('default' => $footer_fragment));

Posted by admin-phpdocx  · 29-07-2013 - 09:27

You may simply create a WordML fragment with addPageNumber and insert it inside any word element that later can be exported to the footer.


Posted by osheec  · 07-04-2014 - 22:43

How? please. We need this feature for a project.



 


Posted by jorgelj  · 08-04-2014 - 09:23

Hello,



Please check included examples within your PHPDocX version. I see you are using the trial version, so you can check the examples and the online documentation.



Regards.


Posted by osheec  · 09-04-2014 - 19:47

Thanks, I check the examples, but I can't find what I am looking for.



 I want:



"<b>Beauty Formated Footer text {NUMBER_PAGE_HERE} more</b> pretty text whatever...."



I tried different ways, but nothing its working.



It's possible or not?



Regards.