Hello,
By default, the parent element of DOCXPath queries is the main document body (w:body) (unless a customQuery is used). If you want to query by any parent you need to set "/" as parent:
Main document body as default, allows to set any parent or a specific one. w:body (default), '/' (any parent) or any other specific parent (/w:tbl/, /w:tc/, /w:r/...).
From the sample DocxPath/removeWordContent/sample_9.php included in the package:
// get the reference node to be removed
$referenceNode = array(
'type' => 'table-row',
'parent' => '/',
'occurrence' => 2,
);
// a custom query can also be used for more complex tasks
/*
$referenceNode = array(
'customQuery' => '//w:tbl/w:tr[2]',
);
*/
$docx->removeWordContent($referenceNode);
Please try the following code with your DOCX:
$referenceNode = array(
'type' => 'table-row',
'parent' => '/',
'contains' => 'Bravo',
);
$docx->removeWordContent($referenceNode);
Regards.