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

Creting Excel stream via web


Recommended Posts

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

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...