I try generate excel view in my report plugin by next code:
HttpServletResponse response = ActionContext.getResponse();
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
out.close();
response.addHeader("content-disposition", contentDispositionValue);
return "";
But when i try get excel view browser send me network error.
What a right way to use Apache poi for generating excel view?
I faced same problem. It was resolved by using
HSSFWorkbook
instead of
XSSFWorkbook
For example:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("sheet1");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
workBook.write(response.getOutputStream());
workBook.close();
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.