PHPWord htmltodocx template

Feb 13, 2013 at 8:27 AM
Hi,

I'm new to PHPWord and have had play round with some of the examples.
What I'm after, is to use the htmltodocx function, whilst using a template.
I've tried to load the template, sections, add html:
$PHPWord = new PHPWord();
$document = $PHPWord->loadTemplate('Template.docx');
$section = $PHPWord->createSection();

$html_dom = new simple_html_dom();
$html_dom->load('<html><body>' . $html . '</body></html>');
...etc...
$objWriter = PHPWord_IOFactory::createWriter($document, 'Word2007');
but when I try to write to the file, I get an error:
Argument 1 passed to PHPWord_IOFactory::createWriter() must be an instance of PHPWord, instance of PHPWord_Template given