Forum


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

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.