Forum


Replies: 8   Views: 1931
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 - 13:33

Sorry for answering my self! ;) Looks like I can use same key!

   $referenceNode = [
      'type' => 'paragraph'
   ];
   $styles = $docx->getWordStyles($referenceNode);
$contents = $docx->getWordContents($referenceNode);
foreach ($contents as $key => $item) {
   if (empty($styles[$key]['pStyle']['val'])) {
      continue;
   }
   $style = $styles[$key]['pStyle']['val'];
   echo $style.' - ';
   echo $item."\n";
}