关于导出excel路径问题

来源:互联网 发布:sql server2000 编辑:程序博客网 时间:2024/06/07 07:33

原理是点击导出按钮,调用方法,参数为一个集合,只需接收本身的流

@RequestMapping(value ="/apply/applyExport",method = RequestMethod.GET)public void export(Apply apply,HttpServletResponse response) throws Exception{List<Apply> list=applyService.query(apply);HSSFWorkbook work = ApplyExport.createExcels(list);SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");String date=sdf.format(new Date());response.setHeader("Content-disposition", "attachment; filename=weibo-"+date+".xls");response.setContentType("application/msexcel");OutputStream out= response.getOutputStream();work.write(out);out.flush();out.close();}