1
Vote

PhpWord not rendering html properly in Word doc

description

html markup renders in browser: "The <b>County Partnership for Children</b> is a <em>not-for-profit</em> agency" - renders in bold, and italics, respectively.

here is my code:
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter( $PHPWord, 'Word2007' );
$fileloaction = '/var/www/rootwebfolder/contracts/tmp';
$filename = 'OCA_'.$LPShort."_".date('YmdHis',time()).'.docx';
$FullName = $fileloaction.'/'.$filename;
//echo $FullName;
$objWriter->save($FullName);
yet the rendered Word document still shows those html tags: The <b>Caswell County Partnership for Children</b> is a <em>not-for-profit</em> agency.

in fact, my app exports 2 files to Word, the first shows the html tags, the 2nd in Word ignores the tags altogether, the text not marked up at all. yet, in the sql database, the tags are in each of the files.

Help?

comments