Forum


Replies: 6   Views: 156
Indexer: check or exclude externals resources

Posted by admin  · 28-11-2024 - 10:55

Hello,

Please check our previous reply, we have updated it. You can use the following DOCXPath reference node to get linked image nodes:

$referenceNode = array(
    'customQuery' => '//w:drawing[.//@r:link]',
);

For example, to remove these nodes from the template:

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

// remove external (linked) images
$referenceNode = array(
    'customQuery' => '//w:drawing[.//@r:link]',
);
$docx->removeWordContent($referenceNode);
$docx->createDocx('template_new');

or to check if any exists:

$referenceNode = array(
    'customQuery' => '//w:drawing[.//@r:link]',
);
$queryInfo = $docx->getDOCXPathQueryInfo($referenceNode);

Regards.