Hello,
We recommend you to check the samples included in the package (DocxPath folder) and the documentation available on https://www.phpdocx.com/documentation/introduction/docxpath. In these samples, you can find a lot of queries, including using custom queries.
For example, the following sample included in the package:
$docx = new CreateDocxFromTemplate('../../files/DOCXPathTemplate.docx');
$referenceNode = array(
'type' => 'paragraph',
'contains' => 'level 2 heading',
);
$styles = $docx->getWordStyles($referenceNode);
print_r($styles);
returns the styles applied to the paragraph that contains level 2 heading. This method returns an array with all styles of the queried content ordered by type.
Regards.