赞
踩
1、获取输出流直接在浏览器下载:加上 os.write(FileCopyUtils.copyToByteArray(file)); 很重要,因为如果你先把该下载文件保留在后台服务器想要下载完后删除的话用这种方式写很好,不然delete总是返回false;
protected void doExcelExport(HttpServletRequest request, HttpServletResponse response, File file,String name) {
OutputStream os = null;
//XSSFWorkbook hssfWorkbook;
try {
String excelName = new String(name.getBytes("GBK"), "ISO-8859-1");
//hssfWorkbook = new XSSFWorkbook(file);
response.addHeader("Content-Disposition", "attachment;filename=" + excelName);
String explorerType = request.getHeader("User-Agent");
if (explorerType != null && !"".equals(explorerType) && explorerType.indexOf("MSIE") > 0) {
response.setHeader("Pragma", "publi
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。