码迷,mamicode.com
首页 > 编程语言 > 详细

spring-excel-导出

时间:2017-08-22 10:36:03      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:strong   mon   not   required   red   ortmap   size   void   auto   

 

导出

1导出策略

技术分享

2导出模板

技术分享

3writer

技术分享

 

应用

    @Autowired(required = false)
    @Qualifier("monthlyPairBillingStatementExportWriter")
    private ExcelWriter monthlyPairBillingStatementExportWriter;

 

 

@RequestMapping("/monthlyPairBillingStatementExport.do")
public void monthlyPairBillingStatementExport(HttpServletResponse response,String ids) throws IOException {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String dateString = formatter.format(new Date());
String fileName = new String(("报价导入模板"+dateString+".xlsx").getBytes("utf-8"),"ISO8859-1");
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName="+fileName);

Map<String, Object> map = new HashMap<>();
if(StringUtils.isNotEmpty(ids)){
map.put("ids",ids);
}
Map<String, Object> exportMap = new HashMap<String, Object>();
//List<FinMonthConnBillVo> finMonthConnBillVos =this.finMonthConnBillService.monthlyPairBillingStatementExportQuery(map);
//ssexportMap.put("monthlyPairBillingStatementExport_Moddle", finMonthConnBillVos);
monthlyPairBillingStatementExportWriter.write(response.getOutputStream(), exportMap);
}

其中writer.write(

response.getOutputStream()

,key为策略名,value为策略vo集合的map)

 

 

js 调用

window.location.href = "../fosp/monthlyPairBillingStatementExport.do";

 

spring-excel-导出

标签:strong   mon   not   required   red   ortmap   size   void   auto   

原文地址:http://www.cnblogs.com/zfzf1/p/7409793.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!