标签:java puts eth exce pos text ext str coder
既然是web项目首先你得拿到响应才能向外部写出,你得拿到响应对象response,
1.添加如下两行代码
response.setContentType("application/vnd..ms-excel");
response.setHeader("content-Disposition","attachment;filename="+URLEncoder.encode(“abc.xlsx”,"utf-8"));
2.修改你的写出方式:
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
hssfWorkbook.write(response.getOutputStream());
标签:java puts eth exce pos text ext str coder
原文地址:http://www.cnblogs.com/azhqiang/p/6651801.html