Forum


Replies: 5   Views: 5045
Html header
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 nikkyb8  · 19-11-2013 - 18:35

Hello i'm trying to insert a html text into my header.



$entete = "<p>Hello</ br> By</p>";



I don't know how i must to do ....



Could you help me ?


Posted by jorgelj  · 20-11-2013 - 09:27

Hello,



You can add HTML to body, headers, footers, footnotes, endnotes and comments using the embedHTML method. You need to use this option:



'target' (string) document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter, footnote, endnote and or comment.



Regards.


Posted by nikkyb8  · 20-11-2013 - 14:22

Hi,



Could you give me an simple exemple ?


Posted by jorgelj  · 21-11-2013 - 09:25

Hello,



Sure, here you're:



$docx= new CreateDocx();



$html= '<p style="border: 2px solid black; color: red">A short text with a red border.</p>';



$rawWordML = $docx->embedHTML($html, array('rawWordML' => true, 'target' => 'defaultHeader'));

$html = $docx->createWordMLFragment(array($rawWordML));

$docx->addHeader(array('default' => $html));



$docx->createDocx('example_embedSimpleHTML');



Regards.


Posted by nikkyb8  · 21-11-2013 - 13:58

Superthank you:)