Replies: 1   Views: 76
No front-page header

Posted by dgray  · 02-08-2019 - 03:07

Why doesn't this work:

$docx->addHeader(array('first' => $firstheaderTable));
$docx->addHeader(array('default' => $headerTable));


I only get the default header on all pages.


I assume that the 'default' header takes priority but how do I easily define a header NOT on the front page? Does this require sections?


Posted by admin  · 02-08-2019 - 06:42


The existing headers in the section are removed when calling addHeader. So you need to call it using the same addHeader call:

$docx->addHeader(array('first' => $firstheaderTable, 'default' => $headerTable));

If you need to generate more complex header/footer layouts or apply them per section you need to use the features included in Advanced and Premium licenses: