I would like to have the number of pages of my document in a template processed by phpWord.
I tried to do it with the following code :
In my template I have "the number of pages is ${total_pages}$
And I tried the following php code :
$pages_text = new TextRun();
$pages_text->addField('NUMPAGES');
$processor->setComplexValue('total_pages',$pages_text);
Problem is it always prints 1 as a number of page. So i have "the number of page is 1" even if my template has 4 pages.
Could you help me with that ?
Thank you