2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 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 More sharing options...
conradt Posted May 12, 2008 Share Posted May 12, 2008 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 More sharing options...
conradt Posted May 12, 2008 Share Posted May 12, 2008 I see - it must be exporter.setParameter(JRExporterParameter.OUTPUT_FILE, new File(fileName)); Link to comment Share on other sites More sharing options...
conradt Posted May 12, 2008 Share Posted May 12, 2008 I see - it must be new File(fileName) instead of just fileName: Code:exporter.setParameter(JRExporterParameter.OUTPUT_FILE, new File(fileName)); Post edited by: conradt, at: 2008/05/12 07:23 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