//定义响应流
String fileName = "文件名_" + System.currentTimeMillis() + ".xls";
//设置相应流格式信息等
fileName = new String(fileName.getBytes(), "ISO8859-1");
response.setContentType("application/octet-stream;charset=ISO8859-1");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.addHeader("Pargam", "no-cache");
response.addHeader("Cache-Control", "no-cache");
OutputStream os = response.getOutputStream();
//将excel对象写到相应流中
workBook.write(os);
os.flush();
os.close();