How to add images dynamically
-
Hello, I have a question, I have to add several images in my excel report, which I get from an api.
My question is, how can I add those images in a specific column?
-
I believe you use the xlsx recipe.
And the transformation approach with thexlsxAdd
and other helpers used to update the xml source files. Right?
In this case, you should use documentedxlsxAddImage
helper and just place images to the right cells. Any problem with that?
-
-
The helper's parameters can be calculated dynamically using handlebars subexpressions
https://handlebarsjs.com/guide/expressions.html#subexpressions{{#xlsxAddImage "test" "sheet1.xml" (acalcColumnFromHelper x) 0 1 1}} {{asset "myImage.png" "base64"}} {{/xlsxAddImage}}
-
I'm trying to do the example, but all my images stay in the same column.
-
Well if you send to
col
helper always constant1
, it will always end with constant2
. You will need probably need use5