Skip to content

Instantly share code, notes, and snippets.

@sunil-bagde
Created October 17, 2018 13:33
Show Gist options
  • Save sunil-bagde/5fe8b9149e30cc832637428e41a5a220 to your computer and use it in GitHub Desktop.
Save sunil-bagde/5fe8b9149e30cc832637428e41a5a220 to your computer and use it in GitHub Desktop.
```php
// https://github.com/PHPOffice
// https://github.com/mtibben/html2text
$phpWord = \PhpOffice\PhpWord\IOFactory::load('Template.docx');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$fullXml = $objWriter->getWriterPart('Document')->write();
$xml = new \SimpleXMLElement($fullXml);
$newString = $xml->asXML();
$html = new \Html2Text\Html2Text($newString );
var_dump( $html->getText());
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment