Forum


Replies: 8   Views: 2093
Transform documents to text
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 kobbe  · 12-02-2020 - 12:29

Thank you, I am trying it out.

Getting error:

Call to a member function getAttribute() on null in <b>xxx/phpdocx-advanced-9.0/classes/CreateDocx.php</b> on line <b>5417</b><br />

Using this:

$docx = new CreateDocxFromTemplate($docx_file);
$referenceNode = [
   'type' => 'paragraph'
];
$styles = $docx->getWordStyles($referenceNode);

 

Checked the code and it looks like this:

   $pStyle = $nodeXPath->query($query, $contentNode);
if ($pStyle > 0) {
    $pStyleName = $pStyle->item(0)->getAttribute('w:val');

Did try a var_dump on $pStyle and this is the result:

object(DOMNodeList)#391 (1) {
  ["length"]=>
  int(0)
}
 

So looks like error in code using:

if ($pStyle > 0) {

 

Is this maybe fixed in 9.5?