Forum


Replies: 2   Views: 957
Add header and footer from html
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 pedern  · 27-09-2022 - 08:12

Hi

I wonder how I can add a header and a footer from to docx that is html

I found this example:

$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');

but I got an php error:

Fatal error: Uncaught Error: Call to undefined method CreateDocx::createWordMLFragment()

This example was from 2014 som maybe it has been replaced???

Best Peder