Jump to content

Detect empty jrprint ?


seboss

Recommended Posts

Hello,

 

I'd like to know how can I detect an empty report before loading it with the JRLoader.loadObject() method.

 

Because when I want to export a report (always the same) with several differents dates given in parameter, I've got white pages in the exported pdf (for each date which has no data in the database source).

 

Is it possible ? Thank for help.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You want to decide whether a report is empty before you load it? I don't think that's possible.

 

If you want to decide whether a report is empty, you first need to set whenNoDataType="NoPages" for the report design and then (when you have the filled report) check jasperPrint.getPages().isEmpty().

 

Regards,

Lucian

Link to comment
Share on other sites

  • 3 weeks later...

I explain again, I use this code :

 

Code:

ArrayList<Object> jpl = new ArrayList<Object>();
String fileGen = JasperFillManager.fillReportToFile(reportPath,parameters, bdd.getConnection());
jpl.add(JRLoader.loadObject(fileGen));

 

I just want to make something like this :

 

Code:
[code]
ArrayList<Object> jpl = new ArrayList<Object>();
String fileGen = JasperFillManager.fillReportToFile(reportPath,parameters, bdd.getConnection());
if (!report.isEmpty()) jpl.add(JRLoader.loadObject(fileGen));

 

But I don't understand how to do with jasperPrint.getPages().isEmpty().

Post edited by: seboss, at: 2006/08/31 07:18

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