Jump to content

spacing in nested subreports


Recommended Posts

By: Amit - amitnl

spacing in nested subreports

2003-09-23 17:06

I am using nested subreports. The problem is when one of the subreports is spread across 2 pages, considerable space is being left blank on the second page.

 

The reports are something like this

Report 1

----------

 

static fields

..

subreport 1

textfields..

subreport 2 etc

 

Subreport 1

-----------

static fields

Subreport 1A

textfield 1A.

Subreport 1B

textfields etc

 

 

The problem occurs when subreport 1A is spread across 2 pages. Also I am finding that there is a some space left after the subreport.

for eg. In Subreport 1 above, there is some space before and after textfield 1A even though the height of the textfield is kept as 0.

 

Please advice.

 

Thanks in advance.

Amit

 

 

 

 

By: Amit - amitnl

RE: spacing in nested subreports ( more info)

2003-09-23 22:08

First Subreport being invoked (Subreport1)

 

<?xml version="1.0"?>

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="ProductHoldingsReport"

pageWidth="530"

pageHeight="700"

whenNoDataType="AllSectionsNoDetail"

columnWidth="515"

columnSpacing="0"

leftMargin="0"

rightMargin="0"

topMargin="30"

bottomMargin="30"

scriptletClass="au.com.suncorp.rpm.reports.Scriptlet">

<reportFont name="Arial_Bold_Heading" isDefault="false" fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="8" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Normal_Narrow" isDefault="true" fontName="Arial" size="6" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="8" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold_Narrow" isDefault="false" fontName="Arial" size="6" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="8" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<parameter name="DealDataSource" class="au.com.suncorp.rpm.reports.DealPricingSummaryDataSource"/>

 

 

<field name="Id" class="java.lang.String"/>

 

 

<variable name="PHDataSource" class="au.com.suncorp.rpm.reports.DealPricingSummaryDataSource" resetType="Group" resetGroup="DealGroup" calculation="System">

<initialValueExpression>$P{DealDataSource}.createDataSource("ProductHoldings")</initialValueExpression>

</variable>

 

 

 

 

<group name="DealGroup">

<groupExpression>

$F{Id}

</groupExpression>

<groupHeader>

 

<band height="107">

 

<rectangle>

<reportElement x="0" y="0" width="530" height="107" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>

<graphicElement stretchType="RelativeToBandHeight"/>

</rectangle>

 

<textField isStretchWithOverflow="true">

<reportElement x="2" y="3" width="525" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Bold_Heading"/>

</textElement>

<textFieldExpression class="java.lang.String">"Other Suncorp Product Holdings:"</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="2" y="15" width="125" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">"Product"</textFieldExpression>

</textField>

 

 

<textField isStretchWithOverflow="true">

<reportElement x="130" y="15" width="95" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">"$Balance (Value Driver)"</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="230" y="15" width="95" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">"Multiplier (% or $)"</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="330" y="15" width="95" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">"ROE"</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="430" y="15" width="97" height="0" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">"$Value-Add (p.a.)"</textFieldExpression>

</textField>

 

<line>

<reportElement x="0" y="17" width="530" height="0" positionType="Float"/>

<graphicElement stretchType="NoStretch"/>

</line>

 

<subreport isUsingCache="true">

<reportElement x="1" y="19" width="528" height="22" positionType="Float" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="false"/>

<subreportParameter name="PHDataSource">

<subreportParameterExpression>

$V{PHDataSource}

</subreportParameterExpression>

</subreportParameter>

<dataSourceExpression>

$V{PHDataSource}

</dataSourceExpression>

<subreportExpression class="java.lang.String">

"reports/ProductsSubReport.jasper"

</subreportExpression>

</subreport>

 

 

<textField isStretchWithOverflow="true">

<reportElement x="2" y="41" width="200" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">

"Total for Other Suncorp Product Holdings:"

</textFieldExpression>

</textField>

 

 

 

<textField isStretchWithOverflow="true">

<reportElement x="2" y="61" width="100" height="25" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">

"Total for Current Deal (per above)"

</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="2" y="86" width="100" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">

"Grand Total"

</textFieldExpression>

</textField>

 

</band>

</groupHeader>

 

</group>

 

 

</jasperReport>

 

 

--------------------------------------------

The following subreport is called from subreport1 above.

-------------------------------------------

 

<?xml version="1.0"?>

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="ProductsSubReport"

pageWidth="530"

pageHeight="700"

whenNoDataType="AllSectionsNoDetail"

columnWidth="515"

columnSpacing="0"

leftMargin="0"

rightMargin="0"

topMargin="30"

bottomMargin="30"

scriptletClass="au.com.suncorp.rpm.reports.Scriptlet">

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="8" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="8" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="8" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<parameter name="PHDataSource" class="au.com.suncorp.rpm.reports.DealPricingSummaryDataSource"/>

 

<field name="Multiplier" class="java.lang.Double"/>

<field name="ProductValueAdd" class="java.lang.Double"/>

<field name="Balance" class="java.lang.Double"/>

<field name="ProductType" class="java.lang.String"/>

 

<variable name="ProductValueAdd" class="java.lang.Double" resetType="None" calculation="Nothing">

<variableExpression>new Double($F{Balance}.doubleValue() * $F{Multiplier}.doubleValue())</variableExpression>

<initialValueExpression>new Double(0)</initialValueExpression>

</variable>

 

<detail>

<band height="21">

<elementGroup>

<textField isStretchWithOverflow="true">

<reportElement x="2" y="1" width="130" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">

$F{ProductType}

</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="130" y="1" width="100" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">((au.com.suncorp.rpm.reports.Scriptlet)$P{REPORT_SCRIPTLET}).formatCurrency($F{Balance})</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="230" y="1" width="100" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">((au.com.suncorp.rpm.reports.Scriptlet)$P{REPORT_SCRIPTLET}).formatPercent($F{Multiplier})</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="330" y="1" width="95" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">((au.com.suncorp.rpm.reports.Scriptlet)$P{REPORT_SCRIPTLET}).formatCurrency($F{Multiplier})</textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement x="425" y="1" width="100" height="20" isPrintWhenDetailOverflows="false" positionType="Float" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Right">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String">((au.com.suncorp.rpm.reports.Scriptlet)$P{REPORT_SCRIPTLET}).formatCurrency($F{ProductValueAdd})</textFieldExpression>

</textField>

</elementGroup>

</band>

</detail>

 

 

</jasperReport>

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