Forum


Replies: 5   Views: 5617
Page numbers: page x of y
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 slobwebsolutions  · 05-10-2014 - 18:20

I'm trying to add some page information to my header. Ideally I would like to have the text "Page X of Y" (X = current page, Y = total number of pages) As far as I can see the total number of pages is not supported. Is that correct? I'm also having some trouble getting "Page X" on the same line. With the following code there is always a break between: $headerPageNumber = new WordFragment($this->docx, 'defaultHeader'); $headerPageNumber->addText('Page', $pageNumberOptions); $headerPageNumber->addPageNumber('numerical', $pageNumberOptions); I also tried something like this: $numbering = new WordFragment($this->docx, 'defaultHeader'); $numbering->addPageNumber('numerical', $pageNumberOptions); $text = array(); $text[] = 'Pagina '; $text[] = $numbering; $headerPageNumber->addText($text); But that does not work at all. Anyone can help me how to get it on the same line?