贾斯珀报道 - 分页问题

时间:2017-03-13 07:06:00

标签: jasper-reports

我在Jasper Reports中进行分页时出现以下问题:

我有一个基于MySql查询结果的报告。每个页面对应于从MySql返回的一行。基本上,详细信息页面上的文本字段打印长文本或clob。

我在“详细信息”部分的末尾添加了分页符。

然而:

  1. 如果我使用“split type”作为“Immediate”,则任何“溢出”的页面都不会发生分页。换句话说,如果文本运行到两个页面,则下一个记录从第2页开始而不是第3页

  2. 如果我使用“拆分类型”作为“预防”,则除了那些文本非常短的记录外,所有记录都会发生额外的分页。额外的页面会打印几个空白页。

  3. 毋庸置疑,任何帮助都会深深感激!

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0  -->
    <!-- 2017-03-18T17:00:56 -->
    <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="TreatmentPlanNotes" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a6476bf3-e703-4b50-9368-2eec564bb444">
        <property name="com.jaspersoft.studio.unit." value="pixel"/>
        <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
        <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <parameter name="beg_dt" class="java.util.Date"/>
        <parameter name="end_dt" class="java.util.Date"/>
        <parameter name="first_name" class="java.lang.String"/>
        <parameter name="last_name" class="java.lang.String"/>
        <field name="created_dt" class="java.sql.Timestamp"/>
        <field name="note" class="java.lang.String"/>
        <field name="patient" class="java.lang.Integer"/>
        <field name="patient_name" class="java.lang.String"/>
        <field name="doctor_name" class="java.lang.String"/>
        <group name="Group1" isStartNewPage="true">
            <groupExpression><![CDATA[$V{REPORT_COUNT}]]></groupExpression>
            <groupHeader>
                <band/>
            </groupHeader>
            <groupFooter>
                <band/>
            </groupFooter>
        </group>
        <background>
            <band splitType="Stretch"/>
        </background>
        <title>
            <band height="57" splitType="Stretch">
                <staticText>
                    <reportElement x="14" y="10" width="184" height="30" forecolor="#3D0D0C" uuid="a847deeb-9517-4108-bb2b-9761158446cf"/>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="20"/>
                    </textElement>
                    <text><![CDATA[Treatment Plans:]]></text>
                </staticText>
                <textField>
                    <reportElement x="185" y="10" width="125" height="30" forecolor="#3D0A08" uuid="bee361db-d322-4d7c-85b9-22c3490ca018">
                        <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    </reportElement>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="20"/>
                    </textElement>
                    <textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format($P{beg_dt})]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="374" y="10" width="129" height="30" forecolor="#3D0A08" uuid="00abf204-6e5d-4c42-ad41-21fc3eb40247">
                        <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    </reportElement>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="20"/>
                    </textElement>
                    <textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format($P{end_dt})]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement x="320" y="10" width="30" height="30" forecolor="#3D0A08" uuid="a602d6a4-51ea-47f1-aceb-4a5dcc4ae88d"/>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="20"/>
                    </textElement>
                    <text><![CDATA[to]]></text>
                </staticText>
            </band>
        </title>
        <detail>
            <band height="250" splitType="Immediate">
                <textField>
                    <reportElement x="4" y="8" width="106" height="24" uuid="f78e49a7-3d65-4a68-9dec-b4708a06db72"/>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="14"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{created_dt}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="128" y="9" width="112" height="24" uuid="2cfbfba2-e429-415c-8737-05282649b74e"/>
                    <textElement>
                        <font fontName="Adobe Garamond Pro Bold" size="14"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{patient_name}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true">
                    <reportElement x="2" y="43" width="550" height="207" isRemoveLineWhenBlank="true" uuid="f15bcb7e-b3d1-4f61-a2ae-63e4807c8a5a"/>
                    <textFieldExpression><![CDATA[ITreatUtils.convertHTMLtoPlain($F{note})]]></textFieldExpression>
                </textField>
            </band>
        </detail>
        <pageFooter>
            <band height="37" splitType="Stretch">
                <textField>
                    <reportElement x="229" y="5" width="100" height="30" isRemoveLineWhenBlank="true" uuid="c19b6d54-120d-449d-a138-f1e6b91641da"/>
                    <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
                </textField>
            </band>
        </pageFooter>
    </jasperReport>
    

0 个答案:

没有答案