prasun Posted February 11, 2010 Share Posted February 11, 2010 Hi,I am new to ireport and facing issue using page break.I have a report which is used as a subreport to a master report. In the subreport I have to print the detail band on new page everytime. I used a page break after the detail band which works fine but obviously it creates another page when the last row is printed in the detail band.this all seems logical to me as far as pagebreak is behaving but for my purpose I don't want to have the last blank page displayedin my pdf. the code for subreport where I have used the pagebreak is attached. I can provide the other code also if needed. the pdf generated is also attached if you wnat to see teh final output.We are not directly using ireport to generate the pdf but are using some document framework which uses the jrxml create through ireport.Any help in this regard will be much appreciated.Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DebitAdvice_Spec_Transaction_SendingBic" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"> <parameter name="ACCOUNT_NUMBER" class="java.lang.String"/> <parameter name="startPeriod" class="java.lang.Long" isForPrompting="false"/> <parameter name="endPeriod" class="java.lang.Long" isForPrompting="false"/> <parameter name="JASPER_UTIL" class="com.zafinlabs.mirev.report.util.JasperUtil" isForPrompting="false"/> <parameter name="ChargesDataset" class="com.zafinlabs.mirev.report.datasets.IterativeDataset" isForPrompting="false"/> <parameter name="ChargesSubreport" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"/> <parameter name="number_format" class="java.lang.String" isForPrompting="false"/> <parameter name="currency_format" class="java.lang.String" isForPrompting="false"/> <parameter name="language_code" class="java.lang.String" isForPrompting="false"/> <parameter name="country_code" class="java.lang.String" isForPrompting="false"/> <field name="sendingBic" class="java.lang.String"/> <variable name="variableMap" class="java.util.Map" resetType="None"> <variableExpression><![CDATA[new HashMap() ); ((Map)value).put("accountNumber",""+$P{ACCOUNT_NUMBER}); ((Map)value).put("startPeriod",$P{startPeriod}); ((Map)value).put("endPeriod",$P{endPeriod}); ((Map)value).put("sendingBicValue",$F{sendingBic}]]></variableExpression> <initialValueExpression><![CDATA[new HashMap()]]></initialValueExpression> </variable> <variable name="currentLocale" class="java.util.Locale" resetType="None"> <variableExpression><![CDATA[new Locale($P{language_code} , $P{country_code} )]]></variableExpression> <initialValueExpression><![CDATA[new Locale($P{language_code} , $P{country_code} )]]></initialValueExpression> </variable> <variable name="nformat" class="java.text.DecimalFormat"> <variableExpression><![CDATA[(DecimalFormat) NumberFormat.getNumberInstance($V{currentLocale}) ); ((DecimalFormat)value).applyPattern($P{number_format}]]></variableExpression> <initialValueExpression><![CDATA[(DecimalFormat) NumberFormat.getNumberInstance($V{currentLocale})]]></initialValueExpression> </variable> <variable name="cformat" class="java.text.DecimalFormat"> <variableExpression><![CDATA[(DecimalFormat) NumberFormat.getNumberInstance($V{currentLocale}) ); ((DecimalFormat)value).applyPattern($P{currency_format}]]></variableExpression> <initialValueExpression><![CDATA[(DecimalFormat) NumberFormat.getNumberInstance($V{currentLocale})]]></initialValueExpression> </variable> <background> <band splitType="Stretch"/> </background> <title> <band splitType="Stretch"/> </title> <pageHeader> <band splitType="Stretch"/> </pageHeader> <columnHeader> <band splitType="Stretch"/> </columnHeader> <detail> <band height="142" splitType="Stretch"> <textField isBlankWhenNull="false"> <reportElement key="textField" x="0" y="0" width="550" height="24"/> <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> <textElement> <font size="11" isBold="true" pdfFontName="Helvetica-Bold"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["SEK account no "+$P{ACCOUNT_NUMBER}+" held with ESSESESS"+" "+"Sending BIC "+$F{sendingBic}]]></textFieldExpression> </textField> <subreport> <reportElement positionType="Float" x="0" y="41" width="550" height="86"/> <subreportParameter name="CURRENCY_FORMAT"> <subreportParameterExpression><![CDATA[$V{cformat}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="NUMBER_FORMAT"> <subreportParameterExpression><![CDATA[$V{nformat}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[$P{JASPER_UTIL}.convertToJRDataSource($P{ChargesDataset} , $V{variableMap})]]></dataSourceExpression> <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{ChargesSubreport}]]></subreportExpression> </subreport> <line> <reportElement x="0" y="30" width="550" height="1"/> <graphicElement> <pen lineWidth="4.0"/> </graphicElement> </line> <break> <reportElement positionType="Float" x="0" y="136" width="100" height="1" forecolor="#FFFFFF"/> </break> </band> </detail> <columnFooter> <band height="1" splitType="Stretch"/> </columnFooter> <pageFooter> <band splitType="Stretch"/> </pageFooter> <summary> <band splitType="Stretch"/> </summary></jasperReport> 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