milto Posted December 14, 2007 Share Posted December 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. Link to comment Share on other sites More sharing options...
svenn Posted December 15, 2007 Share Posted December 15, 2007 Can you run the subreport by itself? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now