You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially the idea is to loop over every image in every document part, if it has an "alt text" attribute set, look in the merge data for either image data or an image url, store it in a temp file, then load that into the relations using the existing functions and update the rid.
I've actually written the code in my own fork of this and tested it and it works brilliantly.
A feature like this i've seen a lot of people on stackoverflow asking for, and I couldn't find a decent solution, one that honoured and reused the original functions of TemplateProcessor as much as possible, therefore I took a stab at it myself.
The developer consuming this package would simply feed in their flattened data array in the same way they do for setValues, and it would work just for images.
If you aren't willing to add this into the main package, im happy to just keep using this in my own package, I just posted the solution here as I've seen a lot of people hutning for this.
I'm also working on a function to handle images inside repetable table rows which should sit nicely with cloneRowAndSetValues. I'm also looking to incorporate in how to handle preserving the aspect ratio of the source image or the placeholder.
Any questions, queries or crticisms are welcomed.
The text was updated successfully, but these errors were encountered:
Essentially the idea is to loop over every image in every document part, if it has an "alt text" attribute set, look in the merge data for either image data or an image url, store it in a temp file, then load that into the relations using the existing functions and update the rid.
I've actually written the code in my own fork of this and tested it and it works brilliantly.
A feature like this i've seen a lot of people on stackoverflow asking for, and I couldn't find a decent solution, one that honoured and reused the original functions of TemplateProcessor as much as possible, therefore I took a stab at it myself.
https://github.com/Lane-Ventures/PHPWord
The developer consuming this package would simply feed in their flattened data array in the same way they do for setValues, and it would work just for images.
If you aren't willing to add this into the main package, im happy to just keep using this in my own package, I just posted the solution here as I've seen a lot of people hutning for this.
I'm also working on a function to handle images inside repetable table rows which should sit nicely with cloneRowAndSetValues. I'm also looking to incorporate in how to handle preserving the aspect ratio of the source image or the placeholder.
Any questions, queries or crticisms are welcomed.
The text was updated successfully, but these errors were encountered: