我正在使用List組件iReport數據正在填充,但pdf有兩個頁面。第二頁中的數據與第一頁相同。我有db中的25條記錄,我想填充到一個頁面中。表格數據在pdf頁面中不斷重複。列表中是否有任何設置可以避免它?我會很感激你的幫助。在iReport中刪除重複的頁面
<?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="test" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="dataset1">
<parameter name="ID" class="java.lang.Integer"/>
<queryString>
<![CDATA[select * from CALENDAR WHERE REGION=$P{ID} ]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="NAME" class="java.lang.String"/>
<field name="REGION" class="java.lang.Integer"/>
<field name="YEAR" class="java.lang.Integer"/>
<field name="HOLIDAY_NAME" class="java.lang.String"/>
<field name="DATE_PICKER" class="java.sql.Date"/>
<field name="APPLICABLE_FROM" class="java.sql.Date"/>
<field name="APPLICABLE_TO" class="java.sql.Date"/>
</subDataset>
<parameter name="ID" class="java.lang.Integer"/>
<queryString>
<![CDATA[select * from USERS]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="EMP_ID" class="java.lang.Integer"/>
<field name="LEVEL_ID" class="java.lang.Integer"/>
<field name="REG_DIV_ID" class="java.lang.Integer"/>
<field name="PROFILE_ID" class="java.lang.Integer"/>
<field name="FINANCE_ID" class="java.lang.Integer"/>
<field name="NOMINEE_ID" class="java.lang.Integer"/>
<field name="PASSPORT_ID" class="java.lang.Integer"/>
<field name="PERSONAL_ID" class="java.lang.Integer"/>
<field name="SALARY_ID" class="java.lang.Integer"/>
<field name="STATUS" class="java.lang.Boolean"/>
<field name="CREATE_DATE" class="java.sql.Timestamp"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="87">
<image>
<reportElement positionType="Float" x="52" y="38" width="123" height="47"/>
<imageExpression class="java.lang.String"><![CDATA["/home/user/Desktop/image003.jpg"]]></imageExpression>
</image>
<image>
<reportElement positionType="Float" x="453" y="30" width="62" height="55"/>
<imageExpression class="java.lang.String"><![CDATA["/home/user/Desktop/image002.jpg"]]></imageExpression>
</image>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="89" splitType="Stretch">
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="52" y="53" width="464" height="29"/>
<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">
<datasetParameter name="ID">
<datasetParameterExpression><![CDATA[$P{ID}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:listContents height="29" width="464">
<textField>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="28" y="5" width="197" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{HOLIDAY_NAME}+" "]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="27" width="464" height="1"/>
</line>
<line>
<reportElement x="0" y="1" width="1" height="28"/>
</line>
<line>
<reportElement x="463" y="0" width="1" height="28"/>
</line>
<line>
<reportElement x="225" y="0" width="1" height="28"/>
</line>
<textField>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="301" y="6" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{DATE_PICKER}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<rectangle>
<reportElement x="52" y="30" width="464" height="23" backcolor="#DD6626"/>
</rectangle>
<textField>
<reportElement x="80" y="35" width="181" height="23"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["HOLIDAYS LIST"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="353" y="35" width="124" height="23"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["DATE"]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="35" splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
您使用SQL數據源嗎?你能發佈jrxml文件的片段嗎? – 2011-12-27 13:24:02
是的,我正在使用SQL數據源.PDF包含不應該發生的重複頁面。表可能包含重複的值。列表以db打印所有數據,包括重複的值,但在此之後它再次從頭開始打印,即整個數據再次重複,這導致以pdf格式重複頁面。 – Anil 2011-12-27 16:33:45
如果表'USERS'包含重複行,您可以在查詢 – 2011-12-28 11:16:56