Forum


Replies: 5   Views: 459
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 admin  · 01-07-2026 - 15:51

Hello,

You can disable the w:titlePg tag from the sections using customizeWordContent available in Premium licenses. As w:titlePg is not one of the predefined styles available in customizeWordContent, you need to use a custom attribute:

$docx = new CreateDocxFromTemplate('template.docx');

$customAttributes = array(
    'customAttributes' => array(
        'w:val' => '0',
    ),
);

// update the document sections (all but the last section)
$referenceNode = array(
    'customQuery' => '//w:sectPr/w:titlePg',
);
$docx->customizeWordContent($referenceNode, $customAttributes);

// update the last section
$referenceNode = array(
    'target' => 'lastSection',
    'customQuery' => '//w:sectPr/w:titlePg',
);
$docx->customizeWordContent($referenceNode, $customAttributes);

$docx->createDocx('output');

If you send to contact[at]phpdocx.com a specific DOCX, we'll generate a custom sample script using it.

Regards.