maven:
<dependency>
<groupId>net.sf.jxls</groupId>
<artifactId>jxls-core</artifactId>
<version>1.0.3</version>
</dependency>
Java:
String templatePath = Thread.currentThread().getContextClassLoader().getResource("jxls/moduleClickTemplate.xlsx").getPath();
InputStream inputStream = new BufferedInputStream(new FileInputStream(templatePath));
Map beans = new HashMap();
beans.put("topicIdList", topicIdList);
beans.put("topicModuleMap", topicModuleMap);
beans.put("result", result);
XLSTransformer xlsTransformer = new XLSTransformer();
org.apache.poi.ss.usermodel.Workbook workbook = xlsTransformer.transformXLS(inputStream, beans);
response.setHeader("Content-Disposition", "attachment;filename=" + new String("模块点击数据".getBytes(),"ISO8859-1")+".xlsx");
response.setContentType("application/vnd.ms-excel");
OutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.flush();
inputStream.close();
outputStream.close();
excel: