execl导入导出
1.导出:
response.setContentType("application/vnd.ms-excel; charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename=" + new String(execlName.getBytes("gb2312"), "ISO8859-1"));
response.setCharacterEncoding("utf-8");
OutputStream os=response.getOutputStream();
//获得Execl表格
HSSFWorkbook wb = doExport(datas,titles,sheetName);
//写入流
wb.write(os);
os.flush();
//关闭流
os.close();
String path = "C:/Users/chencq3/Desktop/billList.xls";
FileOutputStream fileOut = new FileOutputStream(path);
wb.write(fileOut);
fileOut.close();

浙公网安备 33010602011771号