juanpzfz Posted June 7, 2007 Share Posted June 7, 2007 Hi, Scenario: I have a master report and a subreport that has pageFooter. The problem: when I run the Master report, the pageFooter of the Subreport is not at the botton of the page but at the end of detail band. Notice that if I run the subreport alone, the pagefooter is placed correctly at the button of the page. See attached image bellow. See also source code sligthly modified from "demosamplessubreport" of jasperreport bundle. What I'm doing wrong?Thanks in advance. Master report:Code:<?xml version="1.0" encoding="UTF-8" ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="MasterReport" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="515" columnSpacing="0" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="0" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style name="Arial_Italic" isDefault="false" fontName="Arial" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <parameter name="SUBREPORT_DIR" isForPrompting="true" class="java.lang.String"> <defaultValueExpression ><![CDATA["D:\sw\iReport-1.3.2\_compilados"]]></defaultValueExpression> </parameter> <queryString><![CDATA[sELECT City FROM Address GROUP BY City ORDER BY City]]></queryString> <field name="City" class="java.lang.String"/> <variable name="ProductTotalPrice" class="java.lang.Float" resetType="Report" calculation="System"> </variable> <variable name="CityAddressCount" class="java.lang.Integer" resetType="Report" calculation="System"> </variable> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="43" isSplitAllowed="true" > <line direction="TopDown"> <reportElement x="0" y="0" width="515" height="1" key="line"/> <graphicElement stretchType="NoStretch"/> </line> <staticText> <reportElement style="Arial_Normal" x="0" y="10" width="515" height="30" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Center"> <font size="22"/> </textElement> <text><![CDATA[Master Report]]></text> </staticText> </band> </title> <pageHeader> <band height="21" isSplitAllowed="true" > <rectangle> <reportElement x="0" y="5" width="515" height="15" backcolor="#333333" key="rectangle"/> <graphicElement stretchType="NoStretch" pen="None"/> </rectangle> <staticText> <reportElement style="Arial_Bold" mode="Opaque" x="0" y="5" width="515" height="15" forecolor="#FFFFFF" backcolor="#333333" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[City List]]></text> </staticText> <line direction="TopDown"> <reportElement x="0" y="20" width="515" height="1" key="line"/> <graphicElement stretchType="NoStretch"/> </line> </band> </pageHeader> <columnHeader> <band height="0" isSplitAllowed="true" > </band> </columnHeader> <detail> <band height="50" isSplitAllowed="true" > <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Bold" x="5" y="5" width="100" height="15" key="textField" isPrintWhenDetailOverflows="true"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{City}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Band" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Bold" x="110" y="5" width="200" height="15" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$V{CityAddressCount} + " addresses"]]></textFieldExpression> </textField> <staticText> <reportElement style="Arial_Bold" x="110" y="5" width="100" height="15" key="staticText" isPrintRepeatedValues="false" isPrintWhenDetailOverflows="true"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[(continued)]]></text> </staticText> <line direction="TopDown"> <reportElement x="0" y="20" width="515" height="1" key="line" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="NoStretch"/> </line> <subreport isUsingCache="true"> <reportElement x="0" y="21" width="510" height="20" backcolor="#99CCFF" key="subreport" isRemoveLineWhenBlank="true"/> <subreportParameter name="City"> <subreportParameterExpression><![CDATA[$F{City}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <returnValue subreportVariable="REPORT_COUNT" toVariable="CityAddressCount"/> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "\AddressReport.jasper"]]></subreportExpression> </subreport> <break> <reportElement style="Arial_Normal" x="0" y="49" width="515" height="0" key="element-1" positionType="FixRelativeToBottom"/> </break> </band> </detail> <columnFooter> <band height="0" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="0" isSplitAllowed="true" > </band> </pageFooter> <summary> <band height="0" isSplitAllowed="true" > </band> </summary></jasperReport> Subreport:Code:[code]<?xml version="1.0" encoding="UTF-8" ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="AddressReport" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="510" pageHeight="842" columnWidth="510" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="0" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style name="Arial_Italic" isDefault="false" fontName="Arial" fontSize="8" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <parameter name="City" isForPrompting="true" class="java.lang.String"/> <queryString><![CDATA[sELECT * FROM Address WHERE City = $P{City}]]></queryString> <field name="Id" class="java.lang.Integer"/> <field name="FirstName" class="java.lang.String"/> <field name="LastName" class="java.lang.String"/> <field name="Street" class="java.lang.String"/> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="0" isSplitAllowed="true" > </band> </title> <pageHeader> <band height="14" isSplitAllowed="true" > <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Bold" x="292" y="2" width="204" height="10" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Addresses in " + $P{City}]]></textFieldExpression> </textField> <rectangle> <reportElement mode="Transparent" x="0" y="2" width="502" height="10" forecolor="#008080" key="rectangle"/> <graphicElement stretchType="NoStretch" pen="Thin"/> </rectangle> <staticText> <reportElement style="Arial_Italic" x="0" y="2" width="109" height="10" forecolor="#008080" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[Page Header (subreport)]]></text> </staticText> </band> </pageHeader> <columnHeader> <band height="14" isSplitAllowed="true" > <rectangle> <reportElement x="0" y="2" width="20" height="10" forecolor="#CCFFFF" backcolor="#CCFFFF" key="rectangle"/> <graphicElement stretchType="NoStretch"/> </rectangle> <staticText> <reportElement style="Arial_Bold" mode="Opaque" x="0" y="2" width="20" height="10" backcolor="#CCFFFF" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Center"> <font/> </textElement> <text><![CDATA[iD]]></text> </staticText> <staticText> <reportElement style="Arial_Bold" mode="Opaque" x="29" y="2" width="187" height="10" backcolor="#CCFFFF" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[Name]]></text> </staticText> <staticText> <reportElement style="Arial_Bold" mode="Opaque" x="223" y="2" width="279" height="10" backcolor="#CCFFFF" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[street]]></text> </staticText> </band> </columnHeader> <detail> <band height="14" isSplitAllowed="true" > <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="0" y="2" width="20" height="10" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font/> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{Id}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="29" y="2" width="187" height="10" key="textField" positionType="Float"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{FirstName} + " " + $F{LastName}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="223" y="2" width="279" height="10" key="textField" positionType="Float"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{Street}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="14" isSplitAllowed="true" > <rectangle> <reportElement mode="Transparent" x="0" y="2" width="503" height="10" key="rectangle"/> <graphicElement stretchType="NoStretch" pen="Thin"/> </rectangle> <staticText> <reportElement style="Arial_Italic" x="0" y="2" width="60" height="10" key="staticText"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[Column Footer]]></text> </staticText> </band> </columnFooter> <pageFooter> <band height="14" isSplitAllowed="true" > <rectangle> <reportElement mode="Transparent" x="0" y="2" width="502" height="10" forecolor="#008080" key="rectangle" positionType="FixRelativeToBottom"/> <graphicElement stretchType="NoStretch" pen="Thin"/> </rectangle> <staticText> <reportElement style="Arial_Italic" x="0" y="2" width="89" height="10" forecolor="#008080" key="staticText" positionType="FixRelativeToBottom"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[Page Footer (subreport)]]></text> </staticText> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Italic" x="423" y="2" width="50" height="10" forecolor="#008080" key="textField" positionType="FixRelativeToBottom"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of "]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Italic" x="473" y="2" width="20" height="10" forecolor="#008080" key="textField" positionType="FixRelativeToBottom"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> </textField> <staticText> <reportElement style="Arial_Bold" mode="Opaque" x="217" y="2" width="50" height="10" backcolor="#33CCCC" key="staticText" positionType="FixRelativeToBottom"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font/> </textElement> <text><![CDATA[Count :]]></text> </staticText> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="Arial_Bold" mode="Opaque" x="267" y="2" width="25" height="10" backcolor="#33CCCC" key="textField" positionType="FixRelativeToBottom"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font/> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression> </textField> </band> </pageFooter> <summary> <band height="0" isSplitAllowed="true" > </band> </summary></jasperReport> PD: This topic has been touched (but not solved) in Thread: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=20019&catid=9&limit=6&limitstart=6 PD2: I hope to post the image successfully Link to comment Share on other sites More sharing options...
juanpzfz Posted June 7, 2007 Author Share Posted June 7, 2007 Second chance to post the image size=397]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/SubreportFooter400x400.JPG Link to comment Share on other sites More sharing options...
hell.gourmet Posted September 12, 2007 Share Posted September 12, 2007 Hi, I can confirm this bug/feature of JR. I was reading some topics where the only alternative to bypass this problem is use the lastpagereport just in the master report, but, like many of us can imagine this is not a solution in some particular reports. Will be a bless if teo or someone else user with much longer experience in JR than juan or me can explain us if we must abandon any hope about this topic problem. Thanks a lot. Forgive my bad english: is not my native language. PS: I have attached another example similar to juan's example. [file name=subreport_with_pagefooter.zip size=4546]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/subreport_with_pagefooter.zip[/file] 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