In order to understand this template example with jxls it is of importance to read our ReportServer Userguide regarding templates first.It is not explicitly necessary but recommended to do this in order to get a general understanding how templates work in ReportServer.
As an example how templates actually can be used as a small use-case, we will take a dive into this small template example to illustrate exactly this kind of feature within ReportServer. It allows you, in a practical sense via jxls, to use templates within ReportServer.
Creation of a dynamic list
First create a dynamic list and select the columns you need. In this example we use T_AGG_EMPLOYEE example report and select the EMP_MAIL, EMP_EMPLOYEENUMBER, EMP_FIRSTNAME, EMP_JOBTITLE, EMP_LASTNAME, EMP_OFFICECODE, OFF_CITY, OFF_COUNTRY and Y_SALES_AMOUNT columns.
There the preview of data shows us the values of all the columns selected from each record.
This is how the template looks like in an example excel file.
Now the template needs to be uploaded and added into ReportServer. For this the following steps are needed in that order:
- Go to Configure list
- Press on the button Edit template
- Click on the button Add template
- Choose JXLS Format in the pulldown menu Template Type
- Upload the previously created excel document
Now the dynamic list offers a new export format that is called Template.
Due to the example template we created before the output would be the following.
Congratulations! You have succesfully been able to use templates with ReportServer.