Replies: 3   Views: 2993
Table in 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 supriyshah  · 19-06-2013 - 14:28


I am trying to add a single row table in the header. Following is the code I am using:



        $leftHeader, //text

        $centralHeader, //text

        $rightHeader //image



$headeroptions = array('size_col' => array(2120,6656,2120), 'border' => 'single', 'border_sz' => 10);


$headerWordML = $docx->createWordMLFragment(array($finalheader));

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

The table is being generated but not as a part of the header. If I add  'rawWordML' => true to $headeroptions, the array moves to the header but does not show as table. Everything is scattered and the image disappears.

What am I doing wrong?



Posted by jorgelj  · 20-06-2013 - 13:00


We have tested your code and we see the header as a table adding 'rawWordML' => true to $headeroptions, so everythin looks fine. You need to use rawWordML.

Please attach your DOCX to check it.

Regards. Jorge.

Posted by supriyshah  · 21-06-2013 - 13:17

Apologies, I was using Libre Office to test the document. It is working properly in MS Office.