您的位置 首页 > 数码极客

『数据如何导出到excel』wind如何导出数据

导出数据有多种方式,如POI等。这是一个导出全部list的控制器代码:

@Controller public class EmpController { @Resource private EmpService empService; @RequestMapping("/export") public String ExporExcel(HttpServletResponse response) throws Exception { //throws IOException { OutputStream out = re(); ExcelWriter writer =null; String fileName = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); try { fileName =(new Date()); //添加响应头信息 re("Content-disposition", "attachment; filename=" + fileName+"ex;); re("application/msexcel;charset=UTF-8");//设置类型 re("Pragma", "No-cache");//设置头 re("Cache-Control", "no-cache");//设置头 re("Expires", 0);//设置日期头 Ea(out,Emp.class).sheet("导出数据").doWrite()); wri(); out.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { re().close(); } catch (IOException e) { e.printStackTrace(); } } return null; } }


说明:Ea方法中的几个参数是很重要的,如表头的设置、数据源等。

责任编辑: 鲁达

1.内容基于多重复合算法人工智能语言模型创作,旨在以深度学习研究为目的传播信息知识,内容观点与本网站无关,反馈举报请
2.仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证;
3.本站属于非营利性站点无毒无广告,请读者放心使用!

“数据如何导出到excel,wind如何导出数据,金数据如何导出数据,数据如何导入excel表格,matlab如何导出数据”边界阅读