2002 JI Open Discussion Posted August 17, 2006 Share Posted August 17, 2006 By: Servizi - jlda Creting Excel stream via web 2003-01-24 00:22 I launch Jasperreports from my web application. When I generate a report in HTML, PDF, CSV file format everything works well, but, using the JRXlsExporter I receive an empty byte stream. Can anybody help me? By: Matt Hall - matt2k RE: Creting Excel stream via web 2003-01-30 16:58 Hey, Just figured this out myself, it looks something like this (I am assuming you already have your JasperPrint object ready to go): JRXlsExporter exporter = new JRXlsExporter(); ByteArrayOutputStream xlsReport = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, xlsReport); exporter.exportReport(); reportBytes = xlsReport.toByteArray(); Then stream those reportBytes back to the client. Hope that helps. Matt 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