Insert docx rendered to template docx

Jul 9, 2012 at 12:28 PM
Edited Jul 9, 2012 at 2:01 PM

Hi

I would like to use the same function than with values : $document->setValue($search,$replace);

with my html converted to docx.

I need just to replace the $search by my html code. I don't need to create a new file and in fact if i create a new one, i don't know how to insert the content in the other file.

 

How can i do ?

 

Thx

Nov 26, 2012 at 10:54 PM

hi, i've had the same problem and created a simple php function :

https://h2openxml.codeplex.com/

use it to convert your html to openxml, then you can use the setValue function.

Feel free to add content to it, for now it can only do some HTML styles (bold, italic, underlined, and bullet lists)

i will add more with time

Nov 30, 2012 at 12:05 PM

did you try on a template ?

 

your script makes errors.

 

In fact to insert an html formatted text, you would to have to up to precedent <w:p> so setValue can't work.

Nov 30, 2012 at 1:57 PM

it works for the template i'm using.

What errors do you have ?

 

(i used my own styles "<w:pStyle w:val='BulletStyle'/>" to format the text i put into the docx document)