java - How to write a jXLS template and where to write it -


i'm trying use jxls export data list excel sheet. need create excel template using jxls , print out list of data using template. have bean class called department , need use foreach statement loop through list , write data excel sheet.

can please tell me how , can write excel template? know code inside should -

            <jx:foreach items="${departments}" var="department">                 ${department.name} | ${department.chief}             </jx:foreach> 

you need create excel template file in define basic structure need repeat number of objects in collection.

the code

<jx:foreach items="${departments}" var="department">                 ${department.name} | ${department.chief}             </jx:foreach> 

will go in template excel.

then need use jxls api in java code generated excel template.

map contextbeans = new hashmap(); contextbeans.put("departments", departmentlist); xlstransformer.transformxls(xlstemplatefileurl.getpath(), contextbeans, reportfileurl.getpath()); 

this code create excel file out of template file populated collection loaded in contextbeans map.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -