Hi I am wanting to embed the number of pages and current page number into the header (and maybe even the footer) of a document using the embedHTML(). PHPOffice has done something similar to this with thier {PAGE} and {NUMPAGES} constants. I am curious if the same thing can be accomplished with PHPDocx but adding it specifically within a block of HTML that I then embed into the header for example the code might look something like this:
$docx = new CreateDocx(); $headerHTML = '<div>Page {PAGE} of {NUMPAGES}</div>'; $headerFragment = new WordFragment($docx, 'defaultHeader'); $headerFragment->embedHTML($headerHTML); $docx->addHeader(['default' => $headerFragment]); $html = '<h1>Document Content</h1>' $docx->embedHTML($html); $docx->createDocx('path/to/file.docx');