saman0suke Posted July 1, 2011 Share Posted July 1, 2011 Hello, I'm creating a report using iReports 3.7.6 and then converting it through jsp pages into excel format (xlsx), it's working fine ony my computer with Office 2010, but in some computers (not all) with Office 2007, when I select "OPEN" on the prompt asking you if you want to save it or open, it opens the report in excel format, and then opens the report a second time, so I receive two sheets of the same report, here's my code: JasperPrint jasperPrint; String xlsxFileName; ByteArrayOutputStream byteArrayOutputStream; JRXlsxExporter exporterXLSX; File newFile; FileInputStream inputStream; ServletOutputStream ouputStream; jasperPrint = JasperFillManager.fillReport(url_path + "docEmitidosValorizados.jasper", parameters, conn); xlsxFileName = "documentos_emitidos.xlsx"; byteArrayOutputStream = new ByteArrayOutputStream(); exporterXLSX = new JRXlsxExporter(); exporterXLSX.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporterXLSX.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, xlsxFileName); exporterXLSX.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporterXLSX.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporterXLSX.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); exporterXLSX.exportReport(); response.setContentType ("application/vnd.ms-excel"); response.setHeader ("Content-Disposition", "attachment;filename=\"" + xlsxFileName + "\""); ouputStream = response.getOutputStream(); ouputStream.write(byteArrayOutputStream.toByteArray()); ouputStream.flush(); ouputStream.close(); byteArrayOutputStream.flush(); byteArrayOutputStream.close(); I don't know what's happening, could you help me please? as I said, it works with no problems on 2010, but on some computers with Office 2007, I'm getting the report twice on Office, when I select "OPEN" from the JSP page, thanks in advance!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now