poi 文件导出
读取模版-在导出
void downloadTemplate(HttpServletResponse response){
try{
String encodeName = URLEncoder.encode("表名","UTF-8").replaceAll("\\+","%20");
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition","attachment;filename*=utf-8''"+ "文件" +".xls");
String path = System.getProperty("user.dir")+ "/..." + "xx.xls";
FileInputStream fs = new FileInputStream(path);
Workbook wb = new HSSFWorkbook(fs); //这里是个坑,只能用 HSSF
ServletOutPutStream out = response.getOutputStream();
wb.write(out);
}
}