Forum


Replies: 1   Views: 3589
Header that uses multiple wordfragments
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 seb  · 22-01-2015 - 16:48

Hi, I used to be able to create multiple word fragments in an array and put them into a header. This was normally an image and two text boxes. For example: $fragments = array($frag1,$frag2,$frag3,...); $docx->addHeader(array('defaultHeader'=>$fragments)); In phpdocx 4.5 this same code doesn't seem to work, even after upgrading the code to use the new WordFragment class. Is there any way I can add a background image to the header, plus other images and text boxes over the top of it? Thank you very much, Seb

Posted by seb  · 23-01-2015 - 09:57

Cool, I think I figured it out. $header = new \Phpdocx\Elements\WordFragment($docx,'defaultHeader'); $header->addWordML($fgmt_bg_image); $header->addWordML($fgmt_text_box); $docx->addHeader(array('defaultHeader'=>$header)); So far so good! Nice job with v4.5 guys. Cheers, Seb