修改下载的mimetype, 目前excel mimetype是 doc,兼容性比较差在macos 下载excel文件直接变成了 xlw格式了,建议升级 excel mimetype 到 excel2007 + ; 详解:docx、xlsx 这种 office 2007 格式 设置 MIME
This commit is contained in:
parent
2b7bb59d12
commit
5d73bc771f
|
|
@ -322,6 +322,7 @@ public class ExcelUtil<T>
|
||||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) throws IOException
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) throws IOException
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.ms-excel");
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
//response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(list, sheetName, Type.EXPORT);
|
this.init(list, sheetName, Type.EXPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response.getOutputStream());
|
||||||
|
|
@ -335,7 +336,8 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.ms-excel");
|
//response.setContentType("application/vnd.ms-excel");
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(null, sheetName, Type.IMPORT);
|
this.init(null, sheetName, Type.IMPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response.getOutputStream());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue