This project is read-only.

Modify a template

May 10, 2010 at 6:51 AM


First I'd like to say a big thanks to the developers, I'm a big fan of PHPExcel !

I have a template in .doc which I want to open, insert some text in the appropriate places, and return the final doc to the user (ike the mailling function of Word2007). If doing this is very clear with phpexcel, I'm a bit lost with this one. I could re-encode the template in phpword and start with a blank page, but then the people who are going to maintain the system has no idea about PHP. 

Any advise ?

Thanks in advance !

May 10, 2010 at 7:36 AM
Hi, If you want to open an existing word document and modify it, then it will be difficult for you to do it with phpWord. What you can do is to open that document as html , do whatever you want and then re-create the word document. But, PHPWord does not provide any functionality for the first part i.e converting to html. You can take help of open office which provides a functionality like this. Regards, Swarnendu
May 10, 2010 at 8:08 AM

Thanks for the quick reply !

I'll will re-create the header/footer and include all the text which need to be there.

But it would be a very useful feature in the future :)

Thx !

Jul 24, 2010 at 3:05 PM

PHPWord 0.6.2 Beta includes a really simple template system. See current release.


Aug 3, 2010 at 9:51 AM
Edited Aug 3, 2010 at 5:21 PM

I've just tried to update a template with PHPWord but unfortunately it does not work like PHPExcel.

In my own CMS I would like to be able to generate automaticaly a report based on a template with a nice company header and footer

and then create a table with MySQL data.

To sum-up I wish that the class Template was able to replace more than once a token in the template

and also was able to update the template like IOFactory class in PHPExcel does.

Do you think it is something worthy (update Template class) or is it wiser to create from scratch my automatic generated document ?