Jump to content
We've recently updated our Privacy Statement, available here ×

Sub Report is not Displaying in PDF


idilchennai

Recommended Posts

Hi EveryBody,

 

I am have a master report (main.jrxml), inside the pageheader band, i have a subreport (sub.jrxml which has only static fields). I am using JREmptyDataSource (All the things are static field).

 

While running master report it cannot print the subreport (only print the content in master report)

Code

JasperReport subreport = (JasperReport)JasperCompileManager.compileReport("E:\JasperTest\sub.jrxml");

HashMap Parameter = new HashMap();

Parameter.put("subreport",subreport);

jasperReport = JasperCompileManager.compileReport(

"E:\JasperTest\main.jrxml");

jasperPrint = JasperFillManager.fillReport(jasperReport,

Parameter, new JREmptyDataSource());

JasperExportManager.exportReportToPdfFile(

jasperPrint,

"E:\JasperTest\sub-report-test.pdf");

 

Main.jrxml

 

<parameter name="subreport" isForPrompting="true" class="net.sf.jasperreports.engine.JasperReport"/>

 

<pageHeader>

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

<subreport isUsingCache="true">

<reportElement x="5" y="74" width="525"

height="74" forecolor="#3333FF"

backcolor="#00CC00"

key="subreport-1" isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="true"

isPrintWhenDetailOverflows="true"/>

<subreportExpression

class="net.sf.jasperreports.engine.JasperReport">

<![CDATA[$P{subreport}]]></subreportExpression>

</subreport>

</band>

</pageHeader>

 

 

 

sub.jrxml

 

<pageHeader>

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

<staticText>

<reportElement x="95" y="24" width="355"

height="35" key="staticText-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font/>

</textElement>

<text><![CDATA[This is the sub report ]]></text>

</staticText>

</band>

</pageHeader>

 

 

Please Help me (very urgent)..

 

Thank you

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