Subreports

By: Avinash - gavinash
Subreports
2003-01-03 15:39
Hi,
I'm new to JasperReports. I was trying to learn to use subreports in my reports. So I created a report with static texts in it's title and am now trying to embed this report in a MasterReport. It compiles and fills allright byt when I try to view it the subreport does not appear. Can someone give me a direction to solve this problem.
Here;s my subreport and the master report :
<?xml version="1.0"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport
name="SubReport"
pageWidth="150"
pageHeight="15"
columnWidth="150"
leftMargin="0"
rightMargin="0"
topMargin="0"
bottomMargin="0">
<title>
<band height="15">
<staticText>
<reportElement x="0" y="0" width="150" height="15"/>
<textElement textAlignment="Right" lineSpacing="Single">
<font size="12"/>
</textElement>
<text>Part of Subreport</text>
</staticText>

</band>
</title>
</jasperReport>

Place where i embed the above subreport into the Master:
<group name="CountryGroup" isStartNewColumn="true" isResetPageNumber="true" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="200">
<groupExpression>
$F{ShipCountry}
</groupExpression>
<groupHeader>
<band height="155">

<subreport isUsingCache="false">
<reportElement x="300" y="5" width="150" height="15"/>
<connectionExpression>
$P{REPORT_CONNECTION}
</connectionExpression>
<subreportExpression class="java.lang.String">
"SubReport.jasper"
</subreportExpression>
</subreport>
</groupHeader>

Thank You
Avinash





By: Teodor Danciu - teodord
RE: Subreports
2003-01-06 08:32

Hi,

The master report displays anything at all?
Does the master report data source contain any
records in it?

Thank you,
Teodor





By: Avinash - gavinash
RE: Subreports
2003-01-06 09:21
Teodor,
Yes the master reports does have data and it does display it. Also if I get a pdf out of the report the subreport data appears with data properly in the pdf but the viewer does not show the subreport
at all.
Is there something that I'm missing.

Thank You
Avinash





By: Teodor Danciu - teodord
RE: Subreports
2003-01-06 09:33

Hi,

The fact that some data appears in PDF, but not
in the JasperViewer is indeed a little weird.

May I see the PDF and maybe a screenshot of the
report in JasperViewer ?
If you could export the report to XML format
and send it to me it could be even better.

teodord@hotmail.com

Thank you,
Teodor





By: Avinash - gavinash
RE: Subreports
2003-01-06 11:20
Thanks to Teodord, I fixed it. The problem was that the elements had heights of 15 and font size of 12 and apparently font size 12 takes a couple of more pixels than 15 to fit. I changed them to 17 and now it does appear in the viewer.

Avinash
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 7 months ago

0 Answers:

No answers yet
Feedback