开发者

CSV file formatting in JasperReports

开发者 https://www.devze.com 2022-12-25 02:15 出处:网络
I have a Jasper report with bunch of subreports. From what I can see all the subreports are aligned and have the same size, but when it generates the csv file the rows doesnt align with row properly

I have a Jasper report with bunch of subreports. From what I can see all the subreports are aligned and have the same size, but when it generates the csv file the rows doesnt align with row properly

following is the example csv output

,A,,,,,B

,,B,,,X

,Z,,,,,E

File destFile = new File(csvFileName);

JRCsvExporter exporter = new JRCsvExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint1);
exporter.setParameter(JRExporte开发者_如何转开发rParameter.OUTPUT_FILE_NAME, destFile.toString());
exporter.exportReport();


I had a very similar problem, what logically should have been a single row ended up split across two rows in the CSV.

Despite CSV being a logical record structure, the CSV exporter still makes some attempt to map to the graphical layout of the report and will use rows and columns as spacer elements.

To ensure that all the items you wish to be in a a single row, make sure that the elements are all aligned with each other on their top edge. This solved my problem. Align them, recompile the report and all was well.

More information can be found here: http://fecplanner.com/jasperreports/docs/tips.tricks.html#friendly

0

精彩评论

暂无评论...
验证码 换一张
取 消