Jump to content
We've recently updated our Privacy Statement, available here ×

allart

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

i tryed this too but i wrong something "impossible to open the file"



Post Edited by allart at 07/07/2010 09:40

Code:
ByteArrayOutputStream xlsReport = new ByteArrayOutputStream();//ServletOutputStream servletOutputStream = resp.getOutputStream();JRXlsExporter exporterXLS = new JRXlsExporter();exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT,print);exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, xlsReport);//exporterXLS.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, request.getRealPath("/reports") + "/" +title+".xls");exporterXLS.exportReport();System.out.println("Sixe of byte array:"+xlsReport.size()); bytes = xlsReport.toByteArray(); System.err.println("size: "+bytes.length); resp.setContentType("application/vnd.ms-excel"); resp.setContentLength(bytes.length); resp.getOutputStream().write(bytes); resp.getOutputStream().flush();

Post Edited by allart at 07/07/2010 09:43
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...