Replies: 6   Views: 552
Get <w:lastrenderedpagebreak/>, <w:tab/>,<w:t xml:space="preserve">
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 phosira  · 16-11-2022 - 10:28


how to get  <w:lastRenderedPageBreak/>, <w:tab/>,<w:t xml:space="preserve"> from document?

i tried getWordStyles and getWordContents, but not working well.


Posted by admin  · 16-11-2022 - 10:37


getWordStyles returns styles information. getWordContents returns text contents. If you need to get tags (XML) information you can use getDocxPathQueryInfo, that returns an array with elements and other information. In the package you can find some samples using it.


Posted by phosira  · 16-11-2022 - 12:09

  $docx = new CreateDocxFromTemplate('wordUpload/test.docx');
  $asd = array(
    'type' => 'paragraph',
  $queryInfo = $docx->getDocxPathQueryInfo($asd);


when i use getDocxPathQueryInfo,

i only return like this.

Array ( [elements] => DOMNodeList Object ( [length] => 1 ) [length] => 1 [query] => //w:body/w:p[1=1 and contains(., 'BACKGROUND OF THE INVENTION')] )

How can i get tags?

Posted by phosira  · 16-11-2022 - 13:54

  $docx = new CreateDocxFromTemplate('wordUpload/0hwkiexKKE22-00723_up.docx');
  $asd = array(
    'type' => 'paragraph',
    'contains' => '上記回動軸ã¯ã€ä¸Šè¨˜å…‰è»¸ã¨ã­ã˜ã‚Œã®é–¢ä¿‚ã«ã‚ã‚‹ã€å…‰å­¦ç³»ã€‚'
  $queryInfo = $docx->getDocxPathQueryInfo($asd);

  foreach ($queryInfo['elements'] as $element) {
    $attributes = $element->attributes;
        foreach ($attributes as $index=>$attr)
            echo $attr->name."=\"".$attr->value."\"";


i only get that.

 <w:p w14:paraId="2C1EECD0" w14:textId="77777777" w:rsidR="004F0C7A" w:rsidRPr="004F0C7A" w:rsidRDefault="004F0C7A" w:rsidP="004F0C7A">
      <w:r w:rsidRPr="004F0C7A">
      <w:r w:rsidRPr="004F0C7A">

i want to get if this sentence has <w:lastRenderedPageBreak/>, <w:tab/>,<w:t xml:space="preserve">;

how can i?

Posted by phosira  · 17-11-2022 - 09:50

Thanks, I solved it. : )