Component vs ChildTemplate vs ?
-
I have about 300 reports that I am converting from SSRS to JSReport. In the Excel rendering, many of the reports reuse the same functionality with xslxReplace or Merge to do the same thing per report (such as build a header or create a footer or add Properties in Excel). I was hoping there would be a way i could put these reusable xslxReplace or merge pieces in a component or childtemplate in case i need to change it in the future. Then i could update that functionality in 1 place and not have to change the copy/paste in each Excel portion.
Is there a way to do this? I have tried with Component and ChildTemplate and can't seem to do it anywhere. A super simple reused piece would be setting the SheetName to a value in the data.
{{!-- Adding the name to sheet1 of the workbook --}}
{{#xlsxMerge "xl/workbook.xml" "workbook.sheets[0].sheet[0]"}}
<sheet name="{{sheetName}}"/>
{{/xlsxMerge}}
-
That is an interesting problem, thank you for sharing.
We need to make one change in jsreport to make this work. I've put it to the backlog, it should be ready in the jsreport 3.5.0, which should be released in a few weeks.
https://github.com/jsreport/jsreport/issues/908