Jump to content

Recommended Posts

Posted

Hello all,

 

I have a report with 2 subreports.

 

When i test report or subreports individually, everything is ok and 2 pages are printed.

 

But when i want to test all of them, a blank page is printed. I think because parameters are not passed from master report to subreports.

 

Is there anyone that can help me?

 

This is my code :

 

/////////////////////////\\\\\\\\\\\\

 

private void printCard(List lst) {

 

Map parameters = new HashMap();

try{

 

InputStream frontInputStream = getClass().getResourceAsStream("Sub1.xml");

InputStream backInputStream = getClass().getResourceAsStream("Sub2.xml");

InputStream frontBackInputStream = getClass().getResourceAsStream("Master_Report.xml");

 

JasperDesign frontJasperDesign = JasperManager.loadXmlDesign(frontInputStream);

JasperDesign backJasperDesign = JasperManager.loadXmlDesign(backInputStream);

JasperDesign frontBackJasperDesign = JasperManager.loadXmlDesign(frontBackInputStream);

 

JasperReport frontJasperReport = JasperManager.compileReport(frontJasperDesign);

JasperReport backJasperReport = JasperManager.compileReport(backJasperDesign);

JasperReport frontBackJasperReport = JasperManager.compileReport(frontBackJasperDesign);

parameters.put("FrontCoverReport",frontJasperReport);

parameters.put("BackCoverReport",backJasperReport);

 

JRDataSource frontBackJRDataSource = new CustomDataSource(lst);

JasperPrint frontBackJasperPrint = JasperManager.fillReport(frontBackJasperReport, parameters, frontBackJRDataSource);

JasperPrintManager.printReport(frontBackJasperPrint, false);

 

}

catch(Exception ex) {

logExceptions(ex);

}

}

 

 

////////////////////\\\\\\\\\\

 

Sincerely,

Narsis.

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

There is something to be noticed :

 

My master report just containes two subreport elements.

 

I pass all of the fields to Master and pass them from master to subreports as params.

 

But i just get a blank page containing nothing.

 

Although, all of the data are passed to Master

correctly.

 

Sincerely,

 

Narsis.

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