导出Excel中文名

来源:互联网 发布:日本扫码软件 编辑:程序博客网 时间:2024/06/02 06:14
    /**          *           * @Title: exportExcel          * @Description: TODO(导出Excel输出流)          * @param @param fileName          * @param @param wb          * @param @param response 设定文件          * @return void 返回类型          * @throws          */          public void exportExcel(String fileName, HSSFWorkbook wb,              HttpServletResponse response) {          try {              response.setContentType("application/ms-excel;");              response.setHeader("Content-disposition", "attachment;filename="                  + new String(fileName.getBytes("gb2312"), "ISO-8859-1") + ".xls");              OutputStream ouputStream = response.getOutputStream();              wb.write(ouputStream);              ouputStream.flush();              ouputStream.close();          } catch (IOException e) {              e.printStackTrace();          }          }  



原文来自:http://blog.csdn.net/ptzrbin/article/details/8776136

转载只是防止作者误删!方便下次使用。