hello,
i try to use apache poi to return a xls
...finaly i solve by myself i write here to help other
in my main.java
...
get("/consultation/groupeExpXls",Consultation::groupeExpXls);
...
Consultation.java
public static ByteArrayInputStream groupeExpXls(Request req, Response res) throws ClassNotFoundException, SQLException, IOException {
res.header("Content-Disposition", "attachment; filename=tata.xlsx");
res.type("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
return (new ByteArrayInputStream(UtilXls.getPointageGroupe("tata").toByteArray()));
}
see apache poi doc for stuf inside
UtilXls.getPointageGroupe("tata")
//here a point not weel documented d to convert the workbook to stream
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xssWb.write(bos); //XSSFWorkbook
bos.close();
return bos;