Hello,
The Indexer class returns text contents querying text (w:t) tags. A word can use one more w:t tags. Indexer divides each w:t tag using a blank space.
If you want to get words from a DOCX we recommend you to use the getWordContents method. Using this method you can query by paragraph (and other content types if needed) and return all text contents. For example:
$docx = new CreateDocxFromTemplate('document.docx');
// get the reference of the nodes to be returned
$referenceNode = array(
'type' => 'paragraph',
);
$contents = $docx->getWordContents($referenceNode);
print_r($contents);
You can also use a wildcard:
// get the reference of the nodes to be returned
$referenceNode = array(
'type' => '*',
);
This method returns an array with the contents.
Regards.