Forum


Replies: 3   Views: 126
Using getwordstyles with a type

Posted by jeremie  · 17-07-2024 - 09:24

Thank you for your response. You're right, the examples work perfectly. They helped me pintpoint the issue more accurately.

It's the "contains" option that doesn't work properly.

In example \examples\DocxPath\getWordStyles\sample_1.php, changing "contains" from 'level 2 heading' to 'simple Word' returns an empty array, although 'simple Word' is indeed contained in the second line of document \examples\files\DOCXPathTemplate.docx.

In other words, you can't find the string 'simple Word' with the following code:

require_once '../../../classes/CreateDocx.php';

$docx = new CreateDocxFromTemplate('../../files/DOCXPathTemplate.docx');

$docx = new CreateDocxFromTemplate($document_word);
$referenceNode = array(
    'type' => 'paragraph',
    'contains' => 'simple Word',
);
$styles = $docx->getWordStyles($referenceNode);

I think it's a bug because it used to work properly in previous versions.

Let me know if it's not a bug and I will gladly pay for additional technical support.