2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Sohan Kasula - skasula isStartNewPage doesn't work 2003-08-18 14:17 I am using jasperreport 0.4.5 version. I am not able to introduce page breaks by using isStartNewPage = 'true'. I have followed the methodolgy outlined in Tips&Tricks section. In the below xml file, I am trying for page breaks at "QuestionInfo" and "AttachmentsGroup" groups. Any help is appreciated. what am I doing wrong ? If not is this a tool problem. Additionally, How do I use the literal character "&" in the static text field? <?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="APD" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="true"> <parameter name="PSNAPD" isForPrompting="true" class="java.lang.Integer"> <defaultValueExpression><![CDATA[new Integer(1560)]]></defaultValueExpression> </parameter> <queryString><![CDATA[ select eal.LEASE_NUMBER, eal.AREA_CODE, eal.BLOCK_NUMBER, ea.WELL_NAME, ea.WELL_TYPE_CODE, (select APD_STATUS from e_apd_statuses where sn_apd_fk = ea.sn_apd and rownum = 1) APD_STATUS, ea.MMS_COMPANY_NUM, ea.SN_APD from e_apds ea, e_apd_locations eal where ea.sn_apd = eal.sn_apd_fk and upper(WELL_LOC_TYPE) = 'BOTTOM' and sn_apd = $P{PSNAPD} ]]></queryString> <field name="LEASE_NUMBER" class="java.lang.String"/> <field name="AREA_CODE" class="java.lang.String"/> <field name="BLOCK_NUMBER" class="java.lang.String"/> <field name="WELL_NAME" class="java.lang.String"/> <field name="WELL_TYPE_CODE" class="java.lang.String"/> <field name="APD_STATUS" class="java.lang.String"/> <field name="MMS_COMPANY_NUM" class="java.lang.String"/> <field name="SN_APD" class="java.lang.Integer"/> <group name="dummy1" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" > <groupExpression><![CDATA[ $V{REPORT_COUNT} ]]></groupExpression> <groupHeader> <band height="37"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="3" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport1.jasper" ]]></subreportExpression> </subreport> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="21" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="Float" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport3.jasper" ]]></subreportExpression> </subreport> </band> </groupHeader> <groupFooter> <band height="5"> </band> </groupFooter> </group> <group name="dummy2" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" > <groupExpression><![CDATA[ $V{REPORT_COUNT} ]]></groupExpression> <groupHeader> <band height="19"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="3" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport2.jasper" ]]></subreportExpression> </subreport> </band> </groupHeader> <groupFooter> <band height="20"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="4" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="Float" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport6.jasper" ]]></subreportExpression> </subreport> </band> </groupFooter> </group> <group name="QuestionInfo" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" > <groupExpression><![CDATA[ $V{REPORT_COUNT} ]]></groupExpression> <groupHeader> <band height="19"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="3" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport4.jasper" ]]></subreportExpression> </subreport> </band> </groupHeader> <groupFooter> <band height="0"> </band> </groupFooter> </group> <group name="AttachmentsGroup" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" > <groupExpression><![CDATA[ $V{REPORT_COUNT} ]]></groupExpression> <groupHeader> <band height="22"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="4" width="531" height="14" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport5.jasper" ]]></subreportExpression> </subreport> </band> </groupHeader> <groupFooter> <band height="4"> </band> </groupFooter> </group> <title> <band height="21"> <staticText> <reportElement mode="Transparent" x="96" y="3" width="343" height="17" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="14" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Application For Permit To Drill]]></text> </staticText> </band> </title> <pageHeader> <band height="39"> <staticText> <reportElement mode="Transparent" x="2" y="3" width="43" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Lease]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="112" y="3" width="64" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Area/Block]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="261" y="3" width="58" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Well Name]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="386" y="3" width="51" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Well Type]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="112" y="22" width="39" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[status]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="261" y="22" width="43" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Operator]]></text> </staticText> <staticText> <reportElement mode="Transparent" x="2" y="22" width="51" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" /> </textElement> <text><![CDATA[Permit ID]]></text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="45" y="3" width="55" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{LEASE_NUMBER}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="176" y="3" width="26" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{AREA_CODE}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="202" y="3" width="50" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{BLOCK_NUMBER}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="319" y="3" width="58" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{WELL_NAME}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="53" y="22" width="51" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{SN_APD}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="152" y="22" width="80" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{APD_STATUS}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="311" y="22" width="53" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{MMS_COMPANY_NUM}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="437" y="3" width="87" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{WELL_TYPE_CODE}]]></textFieldExpression> </textField> </band> </pageHeader> <columnHeader> <band height="0"> </band> </columnHeader> <detail> <band height="0"> </band> </detail> <columnFooter> <band height="0"> </band> </columnFooter> <pageFooter> <band height="0"> </band> </pageFooter> <summary> <band height="18"> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="3" width="531" height="13" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="PSNAPD"> <subreportParameterExpression><![CDATA[ $P{PSNAPD} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[ "APDSubReport7.jasper" ]]></subreportExpression> </subreport> </band> </summary> </jasperReport> By: Ryan Johnson - delscovich RE: isStartNewPage doesn't work 2003-08-18 17:01 Html escape chars (& > <, etc) can be used for characters that would break the report xml file. As for the startNewPage thing, it looks right to me as well. Maybe you also have to set startNewColumn to true? Good luck, Ryan By: Teodor Danciu - teodord RE: isStartNewPage doesn't work 2003-08-19 07:44 Hi, Use this trick to introduce special characters in XML elements : http://jasperreports.sourceforge.net/faq.html#faq3 As for the isStartNewPage problem, I don't see nothing particular except that you have a detail band with height="0". This should not be a problem, but I did not yet tested it. I hope this helps. Teodor By: Sohan Kasula - skasula RE: isStartNewPage doesn't work 2003-08-19 11:49 faq article helped in fixing "&" problem. However I do still have problem with "isStartNewPage". Thanks, help is appreciated. By: Sohan Kasula - skasula RE: isStartNewPage doesn't work 2003-08-20 11:18 Teodor, Have you had a chance to look into the problem! thanks By: Teodor Danciu - teodord RE: isStartNewPage doesn't work 2003-10-05 02:04 Hi, I think I know what you mean. You have set isStartNewPage for two groups. But the one that is nested does not start a new page of its own because the group that wraps it has already done that. What I mean is that two consecutive group headers share the same new page if no detail comes between them. In other words, a page is consider to be new as long as only group headers have appeared on it. Only when a detail or a group footer has printed, the page is considered new no more. I guess this means you have to reconsider you design. I hope this helps. Teodor 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