网页导出excel文件

response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment; filename="
+ new String(("xx_" + order.getId() + "_" + order.getOrderbbNumber() + ".xls").getBytes("GBK"), "ISO8859_1"));


导出为EXCEL 2003的xls文件。支持大部分主流浏览器。


关于XLSX文件导出:

摘自:http://www.codeproject.com/Questions/58380/Response-contentType-for-Excel-2007

The content type for .xlsx files is;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet


上面的方法未测试。

原文地址:https://www.cnblogs.com/ycpanda/p/3637325.html