jasper 中的静态文本或文本(动态)字段可以跨越两页吗?

can Static text or Text(dynamic) fields in jasper stretch across two pages?

我正在创建一份 pdf 报告,它可能有 4 - 5 页长。我正在使用 jasper studio 来设计 pdf 文档。我创建了 A4 大小的文档,每边边距为 20px。我使用的只是细节带,删除了所有其他带。 detail band 1 包含 page1 content , detail band2 包含 page 2 等等。以下是我想澄清的事情......

  1. 我的做法对吗?因为我只使用细节带来保存内容?做 你看到排除所有其他乐队有什么问题吗?

  2. 我运行陷入空白的问题spaces: detail band1 holds page1, 这个乐队有 802px 的高度,持有 3 部分,第 1 帧(400 像素)第 2 帧(300 像素)和第 3 帧(192 像素)。在我的 case Frame2 的内容会动态拉伸,具体取决于 数据。如果 Frame2 拉伸到 350 像素,现在我只有 52 像素 留在第一个波段,我的 Frame3 是 192 px,结果是碧玉 正在将此框架推到下一页。留下 52px 的空白 space 第 1 页看起来很尴尬。有没有一种方法可以配置 jasper 来显示 第 1 页第 3 帧的 52 像素和第 2 页的其余 140 像素,因此空白 space 不会在任何给定时间显示在 pdf 中?

我尝试在框架元素上使用 StretchType 属性,但似乎没有帮助,有人对此有任何意见吗?提前致谢。

说明我的问题的示例 jrxml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  -->
<!-- 2017-03-24T14:43:38 -->
<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="newIAA" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8de39cec-dd1f-418f-8ba0-9735f2f410ba">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <detail>
        <band height="802">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <frame>
                <reportElement x="0" y="0" width="555" height="190" uuid="eb437bb0-bc94-43e5-8d78-a19c7b2a6b4e">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <staticText>
                    <reportElement x="119" y="0" width="289" height="30" uuid="f2530fdd-884d-43cd-b504-f21e09c9db47">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                        <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 textAlignment="Center">
                        <font size="22" isBold="true" isUnderline="true"/>
                    </textElement>
                    <text><![CDATA[Customer Invoice ]]></text>
                </staticText>
                <staticText>
                    <reportElement x="0" y="80" width="553" height="110" uuid="565fea21-e609-4fae-abdb-640f7c2d322d">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    </reportElement>
                    <textElement markup="styled">
                        <font fontName="SansSerif" size="16"/>
                    </textElement>
                    <text><![CDATA[<b>Details : </b><br/><li>one</li><li>two</li><li>three</li><li>four</li>]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement positionType="Float" x="0" y="190" width="555" height="120" uuid="a28f4d54-6499-4a69-b23f-caf5bbe7d126">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <staticText>
                    <reportElement x="0" y="30" width="555" height="190" uuid="5758f399-38cf-4f98-beda-ee25a9ae785f"/>
                    <textElement markup="styled"/>
                    <text><![CDATA[<b>Shipping Information </b><li>one</li><li>two</li><li>three</li><li>four</li><li>five</li><li>six</li><li>seven</li><li>eight</li><li>nine</li><li>ten</li><li>eleven</li><li>tweleve</li><li>thirteen</li><li>fourteen</li><li>fifteen</li>]]></text>
                </staticText>
            </frame>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="440" width="555" height="280" uuid="ed31eefd-ccc2-419f-b29e-d1f33a855b6a">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12"/>
                </textElement>
                <text><![CDATA[<b>Address:</b><br/><li>one</li><li>two</li><li>three</li><li>four</li><li>five</li><li>six</li><li>seven</li><li>eight</li><li>nine</li><li>ten</li><li>eleven</li><li>tweleve</li><li>thirteen</li><li>fourteen</li><li>fifteen</li><li>sixteen</li><li>seventeen</li><li>eighteen</li><li>nineteen</li>]]></text>
            </staticText>
        </band>
    </detail>
</jasperReport>

Can a text field stretch across two pages?

答案是肯定的,文本字段 元素可以跨越两页,如果您设置它的 属性 溢出溢出TRUE。不过,我不确定 Static Text 元素。我从来没有必要。我尝试了一些 Static Text 元素,但我没有看到可以让它跨越两页的选项。也许,正如它的名字所暗示的,它意味着与 static text 一起使用,一些总是相同的东西,因此你事先知道它将在报告中占据的大小,即使它的位置可以被放置在它上面的其他动态元素改变。

就排除其他频段而言,如果您不需要它们,我认为这没有任何问题。但是,根据您的数据和您想要达到的最终结果,使用其他波段可能会有所帮助。

详细信息 带最适合多行数据集。如果你有一个动态增长的部分,我建议你把它放在一个单独的 details 带中。将 band 的高度设置为 Text Field 的高度(足以容纳您正在显示的文本),然后它将根据需要动态跨越任意多个页面。每当你想把东西放在一个单独的页面上(无条件地)你可以添加一个 Break 元素,并设置 Type 属性转到

在您的示例中,我看到您已将所有数据放入 文本字段 中,这不是一个好的做法。如果您显示的数据是固定的(当我说固定时我指的是一行,而不是多行),请将每个值放在单独的 文本字段 中,它不会留下空白 space 在你的第一页。它会把所有能装进去的东西放在第一页,其余的会移到第二页。

这是您的示例,我对其进行了一些修改。在这里,地址部分跨越两页。

<?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-26T14:03:51 -->
<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="newIAA" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8de39cec-dd1f-418f-8ba0-9735f2f410ba">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <detail>
        <band height="197">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <frame>
                <reportElement x="0" y="0" width="555" height="190" uuid="eb437bb0-bc94-43e5-8d78-a19c7b2a6b4e">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <staticText>
                    <reportElement x="119" y="0" width="289" height="30" uuid="f2530fdd-884d-43cd-b504-f21e09c9db47">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                        <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 textAlignment="Center">
                        <font size="22" isBold="true" isUnderline="true"/>
                    </textElement>
                    <text><![CDATA[Customer Invoice ]]></text>
                </staticText>
                <staticText>
                    <reportElement x="0" y="80" width="553" height="110" uuid="565fea21-e609-4fae-abdb-640f7c2d322d">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    </reportElement>
                    <textElement markup="styled">
                        <font fontName="SansSerif" size="16"/>
                    </textElement>
                    <text><![CDATA[<b>Details : </b><br/><li>one</li><li>two</li><li>three</li><li>four</li>]]></text>
                </staticText>
            </frame>
        </band>
        <band height="214">
            <staticText>
                <reportElement x="0" y="10" width="555" height="190" uuid="5758f399-38cf-4f98-beda-ee25a9ae785f"/>
                <textElement markup="styled"/>
                <text><![CDATA[<b>Shipping Information </b><li>one</li><li>two</li><li>three</li><li>four</li><li>five</li><li>six</li><li>seven</li><li>eight</li><li>nine</li><li>ten</li><li>eleven</li><li>tweleve</li><li>thirteen</li><li>fourteen</li><li>fifteen</li>]]></text>
            </staticText>
        </band>
        <band height="470">
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="10" width="555" height="20" uuid="462f317f-f89a-44ed-8e77-ad07a7b386e6">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Address]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="30" width="555" height="20" uuid="64991fde-9a85-45f7-8061-8b418642e457">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[One]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="50" width="555" height="20" uuid="d5498a2b-1f41-4aa6-b0fd-82ca38f4fc75">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Two]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="70" width="555" height="20" uuid="92617678-99dc-489e-be27-d10ed00da863">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Three]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="90" width="555" height="20" uuid="e63ef22e-1f45-4841-b1c2-d17530ccde8c">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Four]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="110" width="555" height="20" uuid="c355db54-18b6-4fce-9086-e9c0c02d94b6">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Five]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="130" width="555" height="20" uuid="0b81eb8d-c240-4adf-acb8-882fab11666c">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Six]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="150" width="555" height="20" uuid="e50850a3-a9b8-4320-a002-a8fcae766b81">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Seve]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="210" width="555" height="20" uuid="0ad5cd07-2e6a-4a28-90f6-3d12169b8f65">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Ten]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="270" width="555" height="20" uuid="e0dc3fab-9f99-4f75-a420-434562a942f5">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Thirteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="230" width="555" height="20" uuid="dafe0207-10f8-4a97-8f87-2774822d5bed">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Eleven]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="190" width="555" height="20" uuid="4d3d50c6-ace9-4b1c-8ed8-e66ad7d21b60">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Nite]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="170" width="555" height="20" uuid="1f56f519-df14-438d-bd2b-3af7e6e6eaa0">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Eight]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="290" width="555" height="20" uuid="0dffe48d-65b8-4ce3-841f-9d9c85d69ad6">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="250" width="555" height="20" uuid="09c6d28b-2eb1-401a-98ae-7aac905d54df">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Twelve]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="330" width="555" height="20" uuid="600b4b76-9244-4152-aa23-edd23c08d313">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="310" width="555" height="20" uuid="1d7ed52c-a57b-4e70-b645-f259087ec47a">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Thirteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="350" width="555" height="20" uuid="da33f8f6-6269-4da3-9e86-b87037b1e543">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="410" width="555" height="20" uuid="5353b3a4-e9f4-4424-b054-b4158db1f4a8">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Thirteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="390" width="555" height="20" uuid="1e4c1aa6-1a9a-4764-a176-ebb498a99218">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="370" width="555" height="20" uuid="3f8c3dcd-e08d-40ee-8eae-afcfdfbbc14f">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Thirteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="430" width="555" height="20" uuid="f7b1d764-97fa-45bd-99f1-2cd24e889709">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="450" width="555" height="20" uuid="9fadb409-fb15-41ed-9f39-ef6a7b86eaf5">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Fourteen]]></text>
            </staticText>
        </band>
    </detail>
</jasperReport>

我假设您的发货信息 是从数据源中提取的,并且您将其显示在文本字段 元素中。因此,在这种情况下,不要将条带的高度设置为高于 Text Field 元素。它会根据需要占用 space。


更新: 一个最小的、完整的和可验证的例子

为了显示 文本字段 如何跨越两个页面,我包括了一个带有虚拟数据的 jasper 报告。文本嵌入在文本字段中,但当文本字段由数据源填充时,它的工作方式相同。

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  -->
<!-- 2017-03-28T08:17:44 -->
<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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="012f65ad-c3b4-411c-81e1-947ff7200100">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="CRK_DATADAPTER.xml"/>
    <queryString language="SQL">
        <![CDATA[usp_test]]>
    </queryString>
    <field name="Text" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="66" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="20" width="550" height="30" uuid="058b5b66-2862-4130-91a2-7e5817ac10fa"/>
                <textElement textAlignment="Center">
                    <font size="18" isBold="true"/>
                </textElement>
                <text><![CDATA[Title]]></text>
            </staticText>
        </band>
    </title>
    <detail>
        <band height="138" splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <staticText>
                <reportElement x="0" y="0" width="550" height="130" uuid="9d0688b2-a0b4-4ae9-be83-dabc35a3321d"/>
                <textElement markup="html"/>
                <text><![CDATA[Some text goes here:
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>
<li>ka hsdlfkashdfkashdfkasjd fhkashdf </li>]]></text>
            </staticText>
        </band>
        <band height="20">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <textField isStretchWithOverflow="true">
                <reportElement x="100" y="0" width="450" height="20" uuid="7fd5b2f7-5044-465b-b2c3-a68a8263eb7a"/>
                <textElement markup="html"/>
                <textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, insolens tincidunt ea vix. In eos minim detraxit, nibh expetenda pro ex. Iudicabit patrioque mel in. Sumo eligendi eloquentiam eam ei. Iisque bonorum meliore eum te, no viris conceptam his, eu nulla tation fabellas eos. Sea verear laoreet no.<br>Id odio dicant ius, tritani erroribus cum ne. Pri nominavi copiosae eu, est eirmod aliquando moderatius ut, latine commodo labitur ut duo. Dicit dicunt nonumes his te, solet graecis pertinacia ius cu. Mea ne modo deseruisse. Iriure commune tacimates ne sea, qui explicari definitiones cu. Eu salutandi appellantur consequuntur mei, nec te dico nemore.<br>Qui et utamur tacimates honestatis, sea iuvaret fabellas percipitur cu, no vim autem recteque. Vis fugit mundi convenire et, ut sed doming epicuri salutatus. No eius idque ponderum nec. Cum fugit facete ut, an vero saepe inciderint mel.<br>Viris nemore ei nam, qui graece recteque id, nam vero elit ridens ea. Labitur placerat mnesarchum ius an, ad est sonet nonumes. Dicit dicunt labitur nam id, corrumpit torquatos ei nec. Affert consetetur mediocritatem ne nam, inani efficiantur cu duo, civibus contentiones eos et.<br>Definiebas vituperata vis cu, unum fierent an cum. Et enim elitr cum, ex hinc aperiri has, sea in maiorum tibique. Cum iudico detracto cu, choro veniam consul vim et. Qui graeco commodo in, per at eirmod omittam, ut pro sale placerat.<br>Iudico forensibus his ut, no eros facete qualisque qui. Ne dolor facilisis complectitur ius, at cum sale etiam pertinacia, his regione dolorum cu. Ea sale facer usu, wisi paulo simul at duo, tritani dolorum urbanitas et eam. Liber blandit inciderint has cu. Usu an quodsi tibique interesset, at nam movet latine periculis. Mollis copiosae efficiantur vix no, te sit idque accumsan. Pro illud error saepe id, ius ut meliore inermis.<br>Sed ne quaeque aliquam inciderint, an utroque lucilius intellegam per, ius aperiri nonumes adipiscing ea. Vidit virtute his at, cu sit constituam definitionem concludaturque. Fugit fastidii liberavisse per cu. Vim suas omnium ei, et inani sadipscing mel, vis ei expetenda molestiae definiebas.<br>Lorem ipsum dolor sit amet, insolens tincidunt ea vix. In eos minim detraxit, nibh expetenda pro ex. Iudicabit patrioque mel in. Sumo eligendi eloquentiam eam ei. Iisque bonorum meliore eum te, no viris conceptam his, eu nulla tation fabellas eos. Sea verear laoreet no.<br>Id odio dicant ius, tritani erroribus cum ne. Pri nominavi copiosae eu, est eirmod aliquando moderatius ut, latine commodo labitur ut duo. Dicit dicunt nonumes his te, solet graecis pertinacia ius cu. Mea ne modo deseruisse. Iriure commune tacimates ne sea, qui explicari definitiones cu. Eu salutandi appellantur consequuntur mei, nec te dico nemore.<br>Qui et utamur tacimates honestatis, sea iuvaret fabellas percipitur cu, no vim autem recteque. Vis fugit mundi convenire et, ut sed doming epicuri salutatus. No eius idque ponderum nec. Cum fugit facete ut, an vero saepe inciderint mel."]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="0" y="0" width="100" height="20" uuid="21b54d29-9d8c-4c3a-82bb-f2aeb2256941">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <text><![CDATA[Text]]></text>
            </staticText>
        </band>
        <band height="20">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="-5" y="0" width="550" height="20" uuid="cff4e917-c84e-42a6-ae07-5aa19ae0b70f">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement markup="html"/>
                <textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, insolens tincidunt ea vix. In eos minim detraxit, nibh expetenda pro ex. Iudicabit patrioque mel in. Sumo eligendi eloquentiam eam ei. Iisque bonorum meliore eum te, no viris conceptam his, eu nulla tation fabellas eos. Sea verear laoreet no.<br>Id odio dicant ius, tritani erroribus cum ne. Pri nominavi copiosae eu, est eirmod aliquando moderatius ut, latine commodo labitur ut duo. Dicit dicunt nonumes his te, solet graecis pertinacia ius cu. Mea ne modo deseruisse. Iriure commune tacimates ne sea, qui explicari definitiones cu. Eu salutandi appellantur consequuntur mei, nec te dico nemore.<br>Qui et utamur tacimates honestatis, sea iuvaret fabellas percipitur cu, no vim autem recteque. Vis fugit mundi convenire et, ut sed doming epicuri salutatus. No eius idque ponderum nec. Cum fugit facete ut, an vero saepe inciderint mel.<br>Viris nemore ei nam, qui graece recteque id, nam vero elit ridens ea. Labitur placerat mnesarchum ius an, ad est sonet nonumes. Dicit dicunt labitur nam id, corrumpit torquatos ei nec. Affert consetetur mediocritatem ne nam, inani efficiantur cu duo, civibus contentiones eos et.<br>Definiebas vituperata vis cu, unum fierent an cum. Et enim elitr cum, ex hinc aperiri has, sea in maiorum tibique. Cum iudico detracto cu, choro veniam consul vim et. Qui graeco commodo in, per at eirmod omittam, ut pro sale placerat.<br>Iudico forensibus his ut, no eros facete qualisque qui. Ne dolor facilisis complectitur ius, at cum sale etiam pertinacia, his regione dolorum cu. Ea sale facer usu, wisi paulo simul at duo, tritani dolorum urbanitas et eam. Liber blandit inciderint has cu. Usu an quodsi tibique interesset, at nam movet latine periculis. Mollis copiosae efficiantur vix no, te sit idque accumsan. Pro illud error saepe id, ius ut meliore inermis.<br>Sed ne quaeque aliquam inciderint, an utroque lucilius intellegam per, ius aperiri nonumes adipiscing ea. Vidit virtute his at, cu sit constituam definitionem concludaturque. Fugit fastidii liberavisse per cu. Vim suas omnium ei, et inani sadipscing mel, vis ei expetenda molestiae definiebas.<br>Lorem ipsum dolor sit amet, insolens tincidunt ea vix. In eos minim detraxit, nibh expetenda pro ex. Iudicabit patrioque mel in. Sumo eligendi eloquentiam eam ei. Iisque bonorum meliore eum te, no viris conceptam his, eu nulla tation fabellas eos. Sea verear laoreet no.<br>Id odio dicant ius, tritani erroribus cum ne. Pri nominavi copiosae eu, est eirmod aliquando moderatius ut, latine commodo labitur ut duo. Dicit dicunt nonumes his te, solet graecis pertinacia ius cu. Mea ne modo deseruisse. Iriure commune tacimates ne sea, qui explicari definitiones cu. Eu salutandi appellantur consequuntur mei, nec te dico nemore.<br>Qui et utamur tacimates honestatis, sea iuvaret fabellas percipitur cu, no vim autem recteque. Vis fugit mundi convenire et, ut sed doming epicuri salutatus. No eius idque ponderum nec. Cum fugit facete ut, an vero saepe inciderint mel."]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>