Jump to content
Changes to the Jaspersoft community edition download ×

JasperPrint to RTF


Recommended Posts

By: moavan - moavan

JasperPrint to RTF

2006-04-24 08:27

Hello,

 

I hava a JasperPrint object. I want to create a rtf file whith JasperPrint data, but i don´t know how to do it. I can create a pdf using. I want know if exist any similar class or tool to do it in rtf.

 

JasperExportManager.exportReportToPdfFile(jasperPrint, "report.pdf");

 

Forgive my english, please.

Thanks

 

 

 

 

By: LeeBar - leebar

RE: JasperPrint to RTF

2006-04-24 13:13

Use the Rtf exporter:

 

JRRtfExporter exporter = new JRRtfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, fileName);

exporter.exportReport();

 

make sure the poi.jar library is on the classpath.

 

Hope that helps.

 

Lee

Link to comment
Share on other sites

  • 1 year later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Lee,

 

i tried your code (using JR2.0.5 and iText1.4.5) but get the following exception:

 

Code:
Exception in thread "main" java.lang.ClassCastException: java.lang.String
at net.sf.jasperreports.engine.export.JRRtfExporter.exportReport(JRRtfExporter.java:192)
at com.openjades.crm.documents.generator.CVGenerator.generate(CVGenerator.java:38)
at com.openjades.crm.documents.generator.CVGenerator.main(CVGenerator.java:23)

 

CVGenerator.java:

Code:
[code]
JasperPrint jPrint = JasperFillManager.fillReport(resourcesPath + "cv.jasper",new HashMap());
JRRtfExporter exporter = new JRRtfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE, outPath + "CV_1234.rtf"«»);
exporter.exportReport();

 

Any idea what causes the ClassCastException?

Thanks.

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