public void searchexport(String idcards, HttpServletRequest request, HttpServletResponse response,String id) {
OutputStream out = null;
Map map = new HashMap();
XLSTransformer transformer = new XLSTransformer();
InputStream is = UserInfoController.class.getClassLoader().getResourceAsStream("template" + File.separator + "excel" +File.separator + "export" + File.separator + "search.xls");
String downloadFileName = "";
String fileName = "成绩表";
List list = null;
try {
map = testPaperService.searchexport(idcards,id);
} catch(QueryException e1) {
e1.printStackTrace();
}
map.put("title", fileName);
map.put("date", list);
try {
downloadFileName = new String(fileName.getBytes("gbk"), "ISO-8859-1");
response.reset();
response.setContentType("application/octet-stream; charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=\"" + downloadFileName + ".xls\"");
out = response.getOutputStream()
org.apache.poi.ss.usermodel.Workbook workbook = transformer.transformXLS(is, map);
workbook.write(out);
} catch(Exception e) {
e.printStackTrace();
}
}