Forum


Replies: 1   Views: 148
No front-page 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 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

Hello,

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: https://www.phpdocx.com/documentation/cookbook/headers-and-footers-for-sections

Regards.