1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("application/vnd.ms-excel");
String nomFic ="rapport_gesam_"+agent.getNom()+"_"+agent.getPrenom()+".xls";
response.setHeader("Content-Disposition", "inline; filename="+nomFic);
response.setHeader("Content-Description", "Rapport géneré par l'application GESAM");
ServletOutputStream out = response.getOutputStream();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("new sheet");
wb.write(out);
out.close();
return null; |
Partager