Forum


Replies: 3   Views: 34
Force header "different first page" option to false

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.