Creating excel's sheet on loop
-
Hello,
Can we add multiple sheet on loop ?
Example :{{#each Depot}}
{{#xlsxAdd "xl/workbook.xml" "workbook.sheets[0].sheet"}}
<sheet name="{{COL_CODEACTIVITE}}" sheetId="{{#rid COL_CODEACTIVITE}}{{/rid}}" r:id="{{#vid COL_CODEACTIVITE}}{{/vid}}"/>
{{/xlsxAdd}}{{#xlsxAdd "xl/_rels/workbook.xml.rels" "Relationships.Relationship"}}
<Relationship Id="{{#vid COL_CODEACTIVITE}}{{/vid}}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>
{{/xlsxAdd}}{{/each}}
{{{xlsxPrint}}}
This example doesn't work.
Thanks in advance for your help !
-
It is more complicated. See this demo
https://playground.jsreport.net/w/anon/SyL6aErP-2Btw this example is linked directly in the docs, just in case you missed the docs for xlsx...
https://jsreport.net/learn/xlsx
-
Ah ok, you meant to make a "for loop" and add sheets one by one. Sorry I've read it too quickly.
-
Thanks for your reply,
Yes I mean add sheets on a loop.
Hope that you have a solution :).
-
Here you go
https://playground.jsreport.net/w/jan_blaha/wFq~T2U1I know it is complex, but you know the tools (handlebars) and you know the desired result format (unzipped xlsx).
It just needs a lot of patience to reach the goal.
-
Nice !!
Thank you for your help, it takes me two days of work.
I have another questions but i'll do that in another topic.
Thanks again :)
-
We are open to hear proposals how the xlsx recipe could be improved. :)