Jump to content
We've recently updated our Privacy Statement, available here ×

CSV export issue: how to remove page breaks?


jconner

Recommended Posts

When exporting to CSV, we never want any page breaks.  Right now I can export the same report as a PDF and CSV.

Where you see the page break in the PDF, you can look at the CSV and see that a there is also a break in the middle of a large cell.  This issue is mostly noticeable with cells that have several rows of text in them.  The cell is enclosed in quotes.

I would be happy if there was a parameter I could set to skip page breaks like other parameters I am already setting.

ex.

      JRCsvExporter exporter = new JRCsvExporter();

      exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

      exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, csvReport);

      exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ",");

      exporter.exportReport();

 

Code:
Example good row:Bar,"Foo FooFoo FooFoo FooFoo FooFoo FooFoo FooFoo Foo",Example page break:Bar,"Foo FooFoo FooFoo Foo",,"Foo Foo Foo FooFoo FooFoo Foo",
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I thought I did my homework before posting, but a couple more hours of searching and I found the answer.

JRParameter.IS_IGNORE_PAGINATION

Code:
parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);JasperFillManager.fillReport(jasperReport, parameters, connection);
Link to comment
Share on other sites

  • 5 months later...

The problem with that method is that you have to rerun the report essentially to get it to ignore breaks.  We have a situation where we have a report that was executed without that parameter several months back producing a jasperPrint object.  If we want to export that report to CSV without the page breaks using the parameter you suggested, we have to rerun the report.  This results in a situation where the new CSV is likely different from the older jasperPrint thus the CSV results are different. 

Is there any way to do this with the JasperPrint and without having to rerun the report?

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