Jump to content
JasperReports Library 7.0 is now available ×

How to plug subReport in Master Report


2005 IR Help

Recommended Posts

By: itsmeprash - itsmeprash

How to plug subReport in Master Report

2004-08-19 15:02

Hi All,

 

I am using the following code to pluging a subreport into a Master Report

 

I am not using any datasource at all. For now i want to just test without a datasource to plugin a subreport into a Master report. Both the reports have very simple text showing up.

 

 

<%

String jrPath = application.getRealPath("/reports/WebappReport.jasper");

String associatedQARPath = application.getRealPath("/reports/AssociatedQAR.jasper");

 

File reportFile = new File(jrPath);

 

Map parameters = new HashMap();

parameters.put("ReportTitle", pageTitle);

parameters.put("BaseDir", reportFile.getParentFile());

parameters.put("ReportType", ReportType);

parameters.put("assocQarCount", assocQarCount);

parameters.put("AssociatedQARSubreport", associatedQARPath);

 

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

new WebappDataSource()

);

 

 

response.setContentType("application/pdf");

response.setContentLength(bytes.length);

ServletOutputStream outputStream = response.getOutputStream();

outputStream.write(bytes, 0, bytes.length);

outputStream.flush();

outputStream.close();

%>

 

 

 

 

 

 

By: itsmeprash - itsmeprash

RE: How to plug subReport in Master Report

2004-08-19 15:04

Within the Master jrxml file i am using

 

<parameter name="AssociatedQARSubreport" class="java.lang.String"/>

 

 

<band height="131" isSplitAllowed="true" >

<subreport isUsingCache="true">

<reportElement isPrintRepeatedValues="false" x="5" y="25" width="325" height="20" isRemoveLineWhenBlank="true" backcolor="#ffcc99"/>

<subreportExpression class="java.lang.String"><![CDATA["$P{AssociatedQARSubreport}"]]></subreportExpression>

</subreport>

</band>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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