Replies: 3   Views: 3223
How added page-of option to insert numberings of the “page x of y” in format x/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 DenisIdo  · 13-10-2016 - 13:47

The new version has the ability to add page numbers.
I use the example code

$docx = new CreateDocx();

$style = array(
    'bold' => true,
    'color' => 'B70000',
    'sz' => 30,

// create a custom style
$docx->createParagraphStyle('pgStyle', $style);

// create a Word fragment to insert in the footer
$numbering = new WordFragment($docx, 'defaultFooter');
//sert some formatting options
$options = array(
    'textAlign' => 'right',
    'pStyle' => 'pgStyle',
$numbering->addPageNumber('page-of', $options);

$docx->addFooter(array('default' => $numbering));

When using this feature, I kind of numbering is shown Page X of Y.

How can I change the output format to the X / Y?

How can I translate the text "Page of" another language?

Posted by admin  · 14-10-2016 - 06:28


Which license and version of phpdocx are you using?


Posted by DenisIdo  · 14-10-2016 - 08:33


Now I use the trial version to understand phpdocx features.

Please specify which version of the license do I need to buy (Pro, Corporate or Enterprice), so I can change the output format by page numbering.
Please indicate how I can change the page numbering? Can I use a php function to set the changes?