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();

 

posted @ 2017-02-21 11:52  正在学习的孩子  阅读(163)  评论(0编辑  收藏  举报