email_registration_TCEr9ZJ Posted July 4, 2016 Share Posted July 4, 2016 Hi All,I am getting blank pages when I am using two detail bands for generating my pdf file from JRXML.I tried to remove the blank pages programmatically but it's not working as the page is not completely blank it has header and footer included in it. Thanks in advance. Below is the code for my jRXMl:<?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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="559" leftMargin="18" rightMargin="18" topMargin="18" bottomMargin="18" uuid="9bdf4b35-a93b-4369-9b28-49f911057766"><property name="ireport.zoom" value="1.0"/><property name="ireport.x" value="0"/><property name="ireport.y" value="672"/><subDataset name="dataset1" uuid="6ef3d18b-0d5e-408a-b731-a6cbc437a01b"><parameter name="CourseName" class="java.lang.String"/><field name="courseName" class="java.lang.String"/><field name="courseId" class="java.lang.String"/><field name="courseLength" class="java.lang.String"/><field name="tempPositions" class="java.util.ArrayList"/><field name="tempPreReq" class="java.util.ArrayList"/><field name="courseDesc" class="java.lang.String"/><field name="termObjective" class="java.lang.String"/><field name="delMethods" class="java.util.ArrayList"/><field name="assessments" class="java.util.ArrayList"/><field name="ruleList" class="java.util.ArrayList"/><group name="group1" isStartNewPage="true" keepTogether="true"/></subDataset><subDataset name="dataset2" uuid="3eabf5ab-0fea-4ca1-8360-bc61eba22caf"><field name="tarAud" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset3" uuid="008ff2ad-242f-42d1-b7b7-cea6d6805fb5"><field name="preReq" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset4" uuid="9c2c743d-6c2e-4442-9124-57c3aaf6e832"><field name="deliveryMethod" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset5" uuid="7288ab09-d959-45fa-82a7-e005a21a8731"><field name="assessmentsItem" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset6" uuid="d6af71cc-a7ca-45e6-b35b-9e8d5446e5d8"><field name="rule" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset3_1" uuid="98c38c76-ebf1-443f-b929-098cf856ffc6"><field name="preReq" class="java.lang.String"><fieldDescription><![CDATA[_THIS]]></fieldDescription></field></subDataset><subDataset name="dataset11" uuid="315645ba-c5ae-4de3-b04b-7c7011ff5ea4"><parameter name="CourseName" class="java.lang.String"/><field name="courseDesc" class="java.lang.String"/><field name="termObjective" class="java.lang.String"/><group name="group2" isStartNewPage="true" keepTogether="true"/></subDataset><parameter name="CurrentDate" class="java.lang.String"><defaultValueExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format(new Date())]]></defaultValueExpression></parameter><parameter name="CourseName" class="java.lang.String"/><parameter name="CONTEXT" class="java.lang.String"/><field name="courseDetails" class="java.util.Collection"/><field name="tempPositions" class="java.util.ArrayList"/><field name="tempPreReq" class="java.util.ArrayList"/><field name="delMethods" class="java.util.ArrayList"/><field name="assessments" class="java.util.ArrayList"/><field name="ruleList" class="java.util.ArrayList"/><background><band splitType="Stretch"/></background><pageHeader><band height="34"><line><reportElement x="0" y="33" width="559" height="1" uuid="2f7dd6c1-e6da-4db3-82ce-ebcdbe4d7dc6"/></line><textField><reportElement x="219" y="0" width="340" height="34" uuid="3447461b-4dce-4974-9f0d-bcdd392cd58f"/><textElement textAlignment="Right" verticalAlignment="Bottom"><font fontName="Times New Roman" size="14" isBold="true"/></textElement><textFieldExpression><![CDATA[$P{CourseName}]]></textFieldExpression></textField><image><reportElement x="0" y="0" width="219" height="33" uuid="c4f8d28d-cb80-441f-9e2f-9ad04a301f74"/><imageExpression><![CDATA[$P{CONTEXT}+"\bnsf_sws1.png"]]></imageExpression></image></band></pageHeader><detail><band height="742" splitType="Stretch"><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="559" height="742" isRemoveLineWhenBlank="true" uuid="8362b25e-9a66-4180-940c-52f35233fd67"/><jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical"><datasetRun subDataset="dataset1" uuid="ba93aa03-79b9-4c94-90f2-880a963c1d50"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{courseDetails})]]></dataSourceExpression></datasetRun><jr:listContents height="742" width="559"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="117" y="56" width="364" height="20" uuid="33e31cc1-691e-4e97-a89d-ac4f64925936"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{courseId}]]></textFieldExpression></textField><staticText><reportElement positionType="Float" x="2" y="56" width="115" height="20" uuid="53441ea5-a846-472b-8db9-babdb8724fc2"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[unique Course ID:]]></text></staticText><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="117" y="78" width="352" height="20" uuid="74796ae7-590a-42b5-87d5-9754c179d13b"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{courseLength}]]></textFieldExpression></textField><staticText><reportElement x="2" y="3" width="153" height="22" uuid="043a4582-3bf6-4e04-873b-ee51b46d7ac9"/><textElement><font fontName="Times New Roman" size="16" isBold="true" isUnderline="false" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[COURSE OUTLINE]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="34" width="120" height="20" uuid="96e96442-2a0a-4ee1-9696-c07d5b0b537c"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[unique Course Name:]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="78" width="115" height="20" uuid="07d152e6-04e7-4ae3-ab4f-25af6f5d5913"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Course Length:]]></text></staticText><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="122" y="34" width="397" height="20" uuid="89214536-f57e-4939-abc7-8b667bb29391"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{courseName}]]></textFieldExpression></textField><line><reportElement x="2" y="22" width="143" height="1" uuid="979a16f4-5c2a-4358-b296-9a53df7c9111"/></line><staticText><reportElement positionType="Float" x="2" y="100" width="115" height="20" uuid="50724450-bc1a-45eb-9184-71cd1431cdd6"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Target Audience:]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="131" width="118" height="20" isRemoveLineWhenBlank="true" uuid="6c654697-99fa-419a-8fb0-d2e55622665f"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Pre-requisites:]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="173" width="175" height="20" uuid="58ea6aa4-db43-4152-b2d3-11d6ac508799"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Method(s) of Course Delivery:]]></text></staticText><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="2" y="193" width="550" height="20" uuid="3e77cf4c-a8d4-4216-b96c-5fbb85f278d5"/><jr:list printOrder="Horizontal" ignoreWidth="false"><datasetRun subDataset="dataset4" uuid="49966eb9-daf7-4fe4-9e67-1d8d9713fb5b"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{delMethods})]]></dataSourceExpression></datasetRun><jr:listContents height="20" width="160"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="160" height="20" isRemoveLineWhenBlank="true" uuid="30643459-c824-4d5d-919b-a071de1ef2c2"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{deliveryMethod}]]></textFieldExpression></textField></jr:listContents></jr:list></componentElement><staticText><reportElement positionType="Float" x="2" y="236" width="260" height="20" uuid="f5fa61b5-098a-423c-9b9a-867b841ee751"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Course Assessment / Evaluation Methods :]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="256" width="260" height="20" uuid="41d06d62-d5c2-47e6-ba46-f06f2528ba47"/><box leftPadding="70"><pen lineColor="#000000"/><topPen lineWidth="0.5"/><leftPen lineWidth="0.5"/><bottomPen lineWidth="0.5"/><rightPen lineWidth="0.5"/></box><textElement><font fontName="Times New Roman" size="11" isBold="false" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Assessment type(s)]]></text></staticText><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Transparent" x="2" y="276" width="260" height="20" isRemoveLineWhenBlank="true" uuid="3851a829-cfa6-4407-8d11-94201daa5a48"/><jr:list printOrder="Vertical"><datasetRun subDataset="dataset5" uuid="3f0efe9e-0576-4ca7-9c6d-2b3233eab093"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{assessments})]]></dataSourceExpression></datasetRun><jr:listContents height="20" width="260"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="260" height="20" isRemoveLineWhenBlank="true" uuid="0af74563-5d65-4309-b04c-361e6ca5f5dd"/><box leftPadding="20"><pen lineColor="#000000"/><topPen lineWidth="0.5"/><leftPen lineWidth="0.5"/><bottomPen lineWidth="0.5"/><rightPen lineWidth="0.5"/></box><textElement verticalAlignment="Middle"><font fontName="Times New Roman" size="11"/></textElement><textFieldExpression><![CDATA[$F{assessmentsItem}]]></textFieldExpression></textField></jr:listContents></jr:list></componentElement><staticText><reportElement positionType="Float" x="2" y="329" width="427" height="20" uuid="c50374b0-434f-42d7-9873-21ab8b93f068"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><text><![CDATA[This training program includes the following safety-related requirements:]]></text></staticText><staticText><reportElement positionType="Float" x="2" y="308" width="367" height="21" uuid="134378ac-dda1-48ec-bcaa-9bb58b1fef50"/><textElement><font fontName="Times New Roman" size="12" isBold="true" isUnderline="false" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[CFR-243 Training Requirements:]]></text></staticText><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="349" width="512" height="20" uuid="472e2176-8ca5-44d0-9e8e-3ac7b2d08cc1"/><jr:list printOrder="Horizontal"><datasetRun subDataset="dataset6" uuid="e5ef8f0c-6fd7-4e2d-a2c3-0c3aae816d40"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{ruleList})]]></dataSourceExpression></datasetRun><jr:listContents height="20" width="85"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="85" height="20" isRemoveLineWhenBlank="true" uuid="f27f263a-756d-43b1-9ae9-306d5b2f9daa"/><textElement><font fontName="Times New Roman" size="12"/></textElement><textFieldExpression><![CDATA[$F{rule}]]></textFieldExpression></textField></jr:listContents></jr:list></componentElement><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="100" width="539" height="30" uuid="a40db42d-8805-4bad-b436-171413511128"/></frame><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="131" width="539" height="35" uuid="d350a6f3-e996-423f-ad4f-ec74d7764c98"/></frame><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="173" width="550" height="58" uuid="0840a3e2-c129-40b9-bd0d-94e154abd461"/></frame><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="308" width="549" height="72" uuid="70fd62bc-89da-4318-bbab-d01ec5f51353"/></frame><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="235" width="341" height="70" uuid="c33148bb-b8df-4a03-948c-5963866cc7af"/></frame><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="118" y="100" width="421" height="20" uuid="39316d14-7955-47e3-a8ed-68882a62bb88"/><jr:list printOrder="Vertical"><datasetRun subDataset="dataset2" uuid="84636f4c-e729-4af3-8184-22422d3cca37"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{tempPositions})]]></dataSourceExpression></datasetRun><jr:listContents height="20" width="421"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="420" height="20" isRemoveLineWhenBlank="true" uuid="a90b20cb-dcee-4255-b6d2-7bf624467039"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{tarAud}]]></textFieldExpression></textField></jr:listContents></jr:list></componentElement><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="118" y="131" width="419" height="20" uuid="8b0f0bbb-8de9-4e68-ae24-3ea555088d02"/><jr:list printOrder="Vertical"><datasetRun subDataset="dataset3" uuid="5f41509d-58a5-4031-b4d4-49943aaf10f5"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{tempPreReq})]]></dataSourceExpression></datasetRun><jr:listContents height="20" width="419"><textField isStretchWithOverflow="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="418" height="20" isRemoveLineWhenBlank="true" uuid="f7ec9f99-4015-45b4-b0d9-f74064fec98a"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{preReq}]]></textFieldExpression></textField></jr:listContents></jr:list></componentElement></jr:listContents></jr:list></componentElement></band><band height="744" splitType="Stretch"><componentElement><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="20" width="559" height="724" isRemoveLineWhenBlank="true" uuid="3b850fbb-dba6-410c-9fa6-dc1d1da3ff09"/><jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical"><datasetRun subDataset="dataset11" uuid="bcab9669-84a7-4998-a4cf-ef85151878cb"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{courseDetails})]]></dataSourceExpression></datasetRun><jr:listContents height="724" width="559"><staticText><reportElement positionType="Float" x="0" y="57" width="120" height="20" uuid="55dd74ce-280f-4022-8e1f-bf473716011d"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Course Description:]]></text></staticText><textField isStretchWithOverflow="true" isBlankWhenNull="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Transparent" x="120" y="57" width="417" height="20" isRemoveLineWhenBlank="true" uuid="2e0b2a62-81cb-41f8-b315-a718fb79565c"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{courseDesc}]]></textFieldExpression></textField><staticText><reportElement positionType="Float" x="0" y="0" width="175" height="20" uuid="58b76576-8ad4-414b-9d41-d08ef59d289b"/><textElement><font fontName="Times New Roman" size="12" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/></textElement><text><![CDATA[Terminal Learning Objectives:]]></text></staticText><textField isStretchWithOverflow="true" isBlankWhenNull="true"><reportElement positionType="Float" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="0" y="20" width="365" height="20" isRemoveLineWhenBlank="true" uuid="be0a0525-0372-4e8a-814d-0d98225561e6"/><textElement><font fontName="Times New Roman" size="12" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA[$F{termObjective}]]></textFieldExpression></textField><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="2" y="57" width="539" height="32" uuid="39f17a4a-a3f2-4c67-9dc4-6f4d31857bfc"/></frame><frame><reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="539" height="50" uuid="ab909f3f-baad-418f-933a-a407d278b3f2"/></frame></jr:listContents></jr:list></componentElement><break><reportElement positionType="Float" x="0" y="9" width="100" height="1" uuid="e776d537-2203-4dd4-95f5-6e3a6283acce"/></break></band></detail><pageFooter><band height="28" splitType="Stretch"><textField evaluationTime="Report"><reportElement x="541" y="15" width="14" height="13" uuid="44324e96-da5b-40ab-adfb-eb62c7cf66dd"/><textElement textAlignment="Right"><font fontName="Times New Roman" size="8" pdfFontName="Times-Roman"/></textElement><textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression></textField><textField><reportElement x="498" y="15" width="51" height="13" uuid="bf06cb3f-7c16-4915-9e22-6f496b2f4b10"/><textElement textAlignment="Right"><font fontName="Times New Roman" size="8" pdfFontName="Times-Roman" isPdfEmbedded="true"/></textElement><textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression></textField><textField evaluationTime="Report"><reportElement x="274" y="15" width="86" height="13" uuid="4b4f4bea-99d6-42c7-9694-6a3c3deeb805"/><textElement><font fontName="Times New Roman" size="8" pdfFontName="Times-Roman"/></textElement><textFieldExpression><![CDATA[$P{CurrentDate}]]></textFieldExpression></textField><staticText><reportElement x="0" y="15" width="68" height="13" uuid="8a82f686-4b93-4265-8640-4d840250ac6c"/><textElement><font fontName="Times New Roman" size="8"/></textElement><text><![CDATA[Course Outline]]></text></staticText><staticText><reportElement x="219" y="15" width="54" height="13" uuid="5d7b9667-a46d-456b-9357-e668126d09be"/><textElement textAlignment="Right"><font fontName="Times New Roman" size="8" isBold="false"/></textElement><text><![CDATA[Printed Date: ]]></text></staticText><line><reportElement x="0" y="14" width="555" height="1" uuid="a4fc5731-ad06-4232-9238-3a3a3de77eb4"/></line></band></pageFooter></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