Forum


Replies: 2   Views: 3401
Adding html to template
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 allthenations  · 27-02-2012 - 02:41

Hello.

I've noticed a few threads concerning adding HTML into a template. However, it wasn't clear if the issue was resolved. I have just downloaded the newest version (2.4) and am adding HTML into template variables and am getting a corrupt file when attempting to open the file. I've tried it in Word, OpenOffice and Google Docs. None of those will open the file.

I'm using this statement to add as HTML:

require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();
$docx->addTemplate('test.docx');

$x = "<b>Song Title</b><br />Test lyrics";

$docx->addTemplateVariable('SONG', $x,'html');

$docx->createDocx('template');

PLEASE HELP!!