In my web-application i’m using phplivedocx for text changing. But i also need to dynamically change images in my docx template.
What tool do you recommend?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Found the solution.
quote from phplivedocx forum:
“I found a way to insert dynamic image in docx template before sending it to LiveDocx (so it don’t work with hosted templates).
That’s the way I do it (in Php):
– First I put a default image in my local word template
– Before generating the PDF, considere the docx as if it was a zip archive (you can extract manually to confirm it), so:
– In this archive replace the file /word/media/image1.png by the dynamic image (flat png formated, don’t know about format limitations)
– Close the archive.
At this step, if you open the docx template in word, you’ll be able to see the dynamic image replacing the default image.
After that, you can process the request to liveDocx.
There’s some limitations in this method and I hope Boilerplate mecanism will come soon to do it a better way, but in my case it just work like I want.
“
Here is the code how to change image in docx template in php: