采用application/vnd.ms-excel导出excel时修改文件名

设置response属性,如下



response.setContentType("application/vnd.ms-excel;charset=UTF-8");


String fileName = (String) request.getAttribute("fileName");//获取文件名


response.setHeader("Content-Disposition","attachment;filename=" + new String(fileName.getBytes("GBK"), "iso8859-1"));

你可能感兴趣的:(Excel)