日期:2014-05-17 浏览次数:20713 次
protected void downloadExcel(HSSFWorkbook workbook, HttpServletResponse response, String filename) throws IOException { OutputStream out = response.getOutputStream(); response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); response.setContentType("application/msexcel;charset=UTF-8"); workbook.write(out); out.close(); }
------解决方案--------------------
response.getOutPutStream(),往里面写的文件的二进制流,就会在客户端弹出“另存为"文件对话框
------解决方案--------------------