Excel導出文件名有漢字無法顯示

public void bulletinPeopleEndExcelOut() { try { SimpleDateFormat dateToStr = new SimpleDateFormat("yyyyMMdd"); //採用標準格式 這樣不會出現有漢字無法顯示的問題 String fileName = new String(("公安重點人員導入模板_" + dateToStr.format(new Date()) + ".xls").getBytes("gb2312"),"iso8859-1"); response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); response.setHeader("Content-disposition", "attachment;filename="+fileName); EasyExcel.write(response.getOutputStream(), BulletinPeopleTitleInfo.class).sheet("模板").doWrite(null); } catch (IOException e) { e.printStackTrace(); } }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章