frafel Posted September 2, 2006 Share Posted September 2, 2006 Hi! I am starting to use jasperreport engine (using iReport as painter) and I enjoied to see how it work. I created a first simple report using a query to my DB and I produced easily a .PDF and also a .HTML output. But I am interested to obtain a .RTF file and I was unable to realize it because I don't found an appropriate method in the JasperExportManager class; I have seen that there is an astract class (JRRtfExporter) and probably I need to extend that class to solve my need, but unfortunately I am novice in Java and I am not yet able to do this job; so can anyone suggest a snipped of code or a place where Ican find it to obtain what I need? Or alternatively what I must study to produce my first .RTF file with the report? Thank very much. Franco in Italy Link to comment Share on other sites More sharing options...
grzewal Posted September 4, 2006 Share Posted September 4, 2006 Try using JRRtfExporter and it's exportReport() method. Just be sure you have recent enough version of JasperReports. HTH, Grzewal Link to comment Share on other sites More sharing options...
wegnerk Posted September 4, 2006 Share Posted September 4, 2006 it is something like this: Code:exporter = new JRRtfExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "Report.rtf"«»); exporter.exportReport(); this also works for xls, csv, txt and xml similar... if you use this way also for pdf or html, there exists some specific parameter, you can set.... for example:Code:[code]exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";"«»);exporter.setParameter(JRCsvExporterParameter.RECORD_DELIMITER, "n"«»); the field and record delimiter for the csv file... have fun !Post edited by: wegnerk, at: 2006/09/04 08:46 Link to comment Share on other sites More sharing options...
frafel Posted September 6, 2006 Author Share Posted September 6, 2006 Thank you very much. It work well. Franco 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