Jump to content
Changes to the Jaspersoft community edition download ×

Export XLS Report to String


ketro

Recommended Posts

    How can I export my Xls report to a (binary) string instead of file?

JExcelApiExporter XlsExporter = new JExcelApiExporter();
XlsExporter.setParameter(JRExporterParameter.JASPER_PRINT, printedReport);
XlsExporter.setParameter(JRXlsAbstractExporterParameter.IS_DETECT_CELL_TYPE, new Boolean("true"));
XlsExporter.exportReport();
String Xls="";

    Just like I do with PDF's:

JasperExportManager.exportReportToPdf(printedReport)

 

 

---

Thank you!

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Quoting the JasperExportManager.exportReportToPdf(JasperPrint jasperPrint) method, see below (btw, JasperReports is open source).

You can do the same thing with JExcelApiExporter.

HTH,

Lucian

Code:
ByteArrayOutputStream baos = new ByteArrayOutputStream();JRPdfExporter exporter = new JRPdfExporter();		exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);		exporter.exportReport();		return baos.toByteArray();
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...