Forum


Replies: 6   Views: 306
Indexer: check or exclude externals resources
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  · 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.