如何在jrxml文件的Jasper报表中设置每页限制的记录数

时间:2019-07-17 06:15:22

标签: jasper-reports

我有一个jrxml文件,该文件从查询中提取数据并填充在报告中。我想设置可以在单个页面(例如25条记录)中填充的记录计数。因此,如果“记录”计数超过25条记录,则该记录将中断并填充在下一页中。以下是我的样本jrxml文件。请告诉我如何实现这一目标。

<?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="CTC_Report_subreport0"
         columnCount="1"
         printOrder="Vertical"
         orientation="Portrait"
         pageWidth="535"
         pageHeight="802"
         columnWidth="535"
         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.*" />

    <queryString><![CDATA[select *  FROM [Reporting].[dbo].[CTC_Notice]]]></queryString>

    <field name="BENEFIT_NAME" class="java.lang.String"/>
    <field name="CLAIM_NO" class="java.lang.String"/>
    <field name="TREATMENT_DATE" class="java.lang.String"/>
    <field name="CURRENCY" class="java.lang.String"/>
    <field name="INCURRED_AMOUNT" class="java.lang.Double"/>
        <background>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </background>
        <title>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </title>
        <pageHeader>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </pageHeader>
        <columnHeader>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </columnHeader>
        <detail>
            <band height="16"  isSplitAllowed="true" >
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="0"
                        y="1"
                        width="107"
                        height="15"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="Times-Roman" size="7"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{BENEFIT_NAME}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="107"
                        y="1"
                        width="107"
                        height="15"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="Times-Roman" size="7"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{CLAIM_NO}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="214"
                        y="1"
                        width="107"
                        height="15"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="Times-Roman" size="7"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{TREATMENT_DATE}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="321"
                        y="1"
                        width="107"
                        height="15"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="Times-Roman" size="7"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{CURRENCY}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="428"
                        y="1"
                        width="107"
                        height="15"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="Times-Roman" size="7"/>
                    </textElement>
                <textFieldExpression   class="java.lang.Double"><![CDATA[$F{INCURRED_AMOUNT}]]></textFieldExpression>
                </textField>
            </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>

0 个答案:

没有答案