I am using JETT to generate xls from xls template. My input data will be given in pages is there way to append data to sheet as well applying template from input xls to output workbook using Jett api's
Asked
Active
Viewed 377 times
1 Answers
0
It is definitely possible.
You can write some script code at the beginning of your sheet (with ${{ /*your code here;*/ return '';}}
. This code will get the data from the sheets using POI API and will store it in some variables. See how to access POI API from JETT Script here: http://jett.sourceforge.net/expressions/poi_objects.html ).
Once the data is stored into variables, you can insert them in sheets with standard JETT templating capabilities, by referring to the variables that you created in your script block.
Just make sure that the code block creating the variables with data lies before the place where the variables are used in your template.

Etienne C
- 376
- 4
- 9
-
Thanks Etienne, Just to clarify the input data comes from java bean, and then we have xls template with reference to these java bean using jett tags. So every time we have new set of data for same sheet using the same xls template we want to append to the generated xls. at the moment with below code ExcelTransformer transformer = new ExcelTransformer(); Workbook workbook = transformer.transform(fileIn, params); the output file will be overritten with last set of data . We need ability to append to same sheet in the workbook. – anjana Jan 24 '18 at 07:29
-
Thanks for the clarification. The way I'd do it is to create some POI code that will insert the JETT tags (where you insert data) at the end of the data in a sheet ; then you'd call this on the xls file before having JETT insert the data, and this way you can reuse the same XLS file over and over to add data to it. – Etienne C Jan 25 '18 at 13:56