Created
October 17, 2018 13:33
-
-
Save sunil-bagde/5fe8b9149e30cc832637428e41a5a220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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