I am generating reports in PDF, XLS and CSV.
PDF and XLS work fine, but CSV generation is wrong. When the generated report, say in PDF, has only one page, CSV is correct, but when it has more than one page, CSV has one extra comma at the beginning of each row.
The report I'm using was generated with iReport, it has a crosstab and some of the cells are hidden. By hidden I mean I changed the width and height so that they wouldn't be visible.
I read the "Making HTML, XLS or CSV friendly reports" section of the Jasper Reports Tips & Tricks article. It states that for CSV reports, I should give up using page headers, buy I can't do that. I use the same report to generate PDF, XLS and CSV.
This is how I'm doing it:
JasperReport report = JasperCompileManager.compileReport("report.jrxml");
JasperPrint print = JasperFillManager.fillReport(report, parameters, conexion.getConn());
JRCsvExporter exporter = new JRCsvExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "test_report.csv");
exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ",");
exporter.setParameter(JRCsvExporterParameter.RECORD_DELIMITER, System.getProperty("line.separator"));
exporter.exportReport();
I tried changing the RECORD_DELIMITER by "\r\n" and "\n", but it doesn't work.
Thanks for your attention.
Laura.
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions