Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems Ireport and jasper reports SUBREPORTS

807603Dec 14 2007
I designed a mainReport and a subreport, but I can�t see the subreport when executing the mainReport.

I use the subreport Tool, and subreport's absolute path.

The subreport doesn't need any connection or paremeters, because it's a Static text.


The two Java source codes:


First:*

JasperReport jasperReport;
JasperPrint jasperPrint;
Map parameters = new HashMap();
ReportSource reportSource=new ReportSource(con);

jasperReport = JasperCompileManager.compileReport(
"c:/java/workspace/JasperOskar/conf/MainReport.jrxml");


jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,reportSource);


JasperExportManager.exportReportToPdfFile(
jasperPrint,"c:/java/workspace/JasperOskar/conf/mainReport.pdf");



Second:*


JasperReport jasperReport;
JasperPrint jasperPrint;
Map parameters = new HashMap();
ReportSource reportSource=new ReportSource(con);

JasperReport masterReport = null;

masterReport = (JasperReport) JRLoader.loadObject("c:/java/workspace/JasperOskar/conf/MainReport.jrxml");

JasperReport subReport1 = null;

subReport1 = (JasperReport) JRLoader.loadObject("c:/java/workspace/JasperOskar/subReport.jrxml");




Map masterParams = new HashMap();
masterParams.put("SUBREPORT",subReport1);

JasperPrint masterPrint = null;

masterPrint = JasperFillManager.fillReport(masterReport, masterParams,reportSource );

JasperExportManager.exportReportToPdfFile(
masterPrint, "c:/java/workspace/JasperOskar/conf/MainReport.pdf");

JasperViewer.viewReport(masterPrint, false);



Please help me as I need a solution.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2008
Added on Dec 14 2007
0 comments
182 views