Forum


Replies: 5   Views: 462
Force header "different first page" option to false
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 sdespont  · 02-07-2026 - 08:30

Hello,

thanks for your reply, I thought about this solution :

$this->docx = new CreateDocxFromTemplate($templatePathPrefix.$filePath);   
     
// Retrieve template variables
$this->wordTemplateVariablesArray = $this->docx->getTemplateVariables();

// Re-import the headers and footers with setDefault as TRUE
$this->docx->importHeadersAndFooters($templatePathPrefix.$filePath, 'headerAndFooter', ['setDefault' => true]);

This works correctly and is simpler than the complex call to `customizeWordContent`. However, a small problem remains: when `importHeadersAndFooters` is used, the variables of the imported header and footer are not loaded for replacement. Could you check if it would be possible to load the new variables when loading the headers and footers via `importHeadersAndFooters`?

Thank you.