Hello,
phpdocx_text and other tags are added as block content; this is the same than using addText standalone. But this tag doesn't replicate the behaviour of:
$text = array();
$text[] = $footerImage;
$text[] = $pageNumber;
$text[] = $divider;
$text[] = $docTitle;
This is adding several elements into a single paragraph as inline contents.
Using HTMLExtended, we recommend you to add the contents using a table, as the included example Core/embedHTML/sample_7.php:
$html = '
<head>
<style>
p {font-style: italic;}
p.header {font-size: 20px; font-weight: bold;}
div.footer {font-size: 10px;}
</style>
</head>
<phpdocx_header data-type="default">
<p class="header">
Custom header <strong>with strong style</strong>
<phpdocx_link data-text="External link" data-url="http://www.google.es" />
</p>
</phpdocx_header>
<p>Lorem ipsum dolor sit amet.</p>
<phpdocx_footer>
<div class="footer">
<table border="1" style="border-collapse: collapse" width="600">
<tbody>
<tr width="600">
<td>Cell A</td>
<td><img src="../../img/image.png" width="35" height="35" style="vertical-align: -15px"></p></td>
<td><phpdocx_pagenumber data-target="defaultFooter" data-type="page-of" data-textAlign="right" /></td>
</tr>
</tbody>
</table>
</div>
</phpdocx_footer>
';
$docx->embedHTML($html, array('useHTMLExtended' => true));
This same sample adds an image to the footer and the output is correctly. Please run it and check the output; for footers and headers please use img tag instead of phpdocx_image.
The next version of HTML Extended will include support to set a target when adding contents to footers and headers (as phpdocx_image needs).
Regards.