当在 jaspersoft 子报表中的 table 中添加更多行时,打印第一页成功而其他为空,为什么?
When adding more rows in table in jaspersoft subreport in print the first page success and other is empty, why?
我有一个主报表,这个主报表包含两个子报表,
第一个子报表包含两个table,当第一个table上有很多数据时,它打印第一页成功,但其他页面为空。
预期的输出是继续显示第一个 table 的行,直到它转到第二个 table,如果没有大量数据它可以正常工作
这是设计代码:
<band height="429">
<staticText>
<reportElement x="13" y="5" width="100" height="60" uuid="b236e2f4-495e-4a22-87fa-4e316ea5f41f"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Account Number :]]></text>
</staticText>
<staticText>
<reportElement x="13" y="27" width="89" height="18" uuid="7fdc8df6-4c51-4d87-b8f7-cb0acec8acef"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Description :]]></text>
</staticText>
<staticText>
<reportElement x="13" y="47" width="80" height="21" uuid="294925d2-bf2a-4c51-9f8a-339873e0f747"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Period from :]]></text>
</staticText>
<textField>
<reportElement x="113" y="7" width="100" height="17" uuid="0406491b-1bdb-41db-8ece-4058578dc28a"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{CUSTOMERACCOUNTNUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="24" width="350" height="23" uuid="f3a441fe-3d57-490d-9d24-cd0d060694f3"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Summary invoice for "+ $F{COMPANYNAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="204" y="47" width="100" height="20" uuid="e71997f3-50fb-4736-8fdc-cd74d95204db"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{PERIODTO}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="174" y="47" width="30" height="20" uuid="bec9327c-65d8-4070-9b55-ddeaa6527e2f"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[ To:]]></text>
</staticText>
<textField>
<reportElement x="94" y="47" width="80" height="20" uuid="9e431304-75d4-43e6-9e7b-663a1dabf504"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{PERIODFROM}]]></textFieldExpression>
</textField>
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="20" y="-10" width="760" height="287" isPrintWhenDetailOverflows="true" uuid="81f11b41-36e2-4795-9965-02ae41b1b338"/>
<box>
<topPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<leftPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<bottomPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<rightPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
</box>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="21" y="111" width="724" height="60" isPrintWhenDetailOverflows="true" uuid="6b9558ad-488a-4954-98f0-b4a4c19a3dbe">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="InvoiceDetailDS" uuid="d4a58f73-73e9-432a-bc4c-bc82959e3959">
<datasetParameter name="headerId">
<datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="95" uuid="52966a24-1f98-4445-b6f6-f83ada4ec1f8">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="868f2a68-0cba-47ce-9c30-f955deb28e85"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Service ID]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="4dce2c60-c99f-4752-9697-492e8e2d9930"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ORDERSERVICEID}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="92" uuid="bb1703e2-5b7e-4bef-9772-e40ee123a9bd">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="92" height="30" backcolor="#A6FFB5" uuid="56038351-cd7e-4c6d-9158-4d071e26faf8"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Order Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="92" height="30" uuid="f1d27619-7b71-407d-a449-f3bfa1906c93"/>
<box>
<topPen lineWidth="0.3"/>
<leftPen lineWidth="0.3"/>
<bottomPen lineWidth="0.3"/>
<rightPen lineWidth="0.3"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ROSNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="95" uuid="2703ba82-935b-496b-a4af-223f33a4a23c">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:tableFooter height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="f1fe79d1-2cea-42b1-88cb-1bc4e70ef6e1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Action Type]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter height="0" rowSpan="1"/>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="d512d971-c04f-4ecf-8a11-22b3fcbdffc0"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ACTIONTYPE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="479436d0-de8d-4cd6-9b8d-cc8f42eef53d">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="80" height="30" backcolor="#A6FFB5" uuid="9d46cd49-e847-4967-b69b-daa03cb3ed2f"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Invoice From]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="80" height="30" uuid="9b755792-0ce6-4144-985a-cf2f50e97c4b"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{INVOICEFROM}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="71" uuid="3b39699e-eeda-408c-a2af-d45125fe57ed">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="71" height="30" backcolor="#A6FFB5" uuid="5426229a-2a89-4335-aa9f-b42b51707041"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Invoice To]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="71" height="30" uuid="38071396-7786-4aec-ae98-64780811e474"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{INVOICETO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="101" uuid="6c5336a5-d796-469d-b843-f1062bf7f7ca">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="101" height="30" backcolor="#A6FFB5" uuid="49d8ab5c-272e-428d-b4c2-466c13d9a2b7"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Non-Recurring Charges]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="101" height="30" uuid="a93bc30f-13bc-4eaf-9cec-92849cc69756"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{NRC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="99" uuid="f2b13180-33c5-405d-883f-402c53c8cf20">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="99" height="30" backcolor="#A6FFB5" uuid="4cc22936-e12f-4bca-bb22-453d021d61c1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Recurring Charges]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="99" height="30" uuid="b5639d81-207e-432c-b3e0-793bf7dd533e"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{MRC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="d2a8e5ef-097b-4e8c-b0bd-84f8f2a272bd">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" backcolor="#A6FFB5" uuid="b2f75a95-5ac4-415b-b64b-05bcf3c77bef"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Amount SAR]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="30" uuid="0b9a5ef9-9e8a-406f-ab70-95d32ff00a40"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{TOTALAMOUNT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
</band>
</title>
<summary>
<band height="326">
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="130" y="120" width="760" height="206" isPrintWhenDetailOverflows="true" forecolor="#000000" uuid="1c3a92e7-b648-4580-acae-afb17ad5d59e"/>
<box>
<topPen lineWidth="2.0" lineColor="#20E827"/>
<leftPen lineWidth="2.0" lineColor="#20E827"/>
<bottomPen lineWidth="2.0" lineColor="#20E827"/>
<rightPen lineWidth="2.0" lineColor="#20E827"/>
</box>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="-89" y="-19" width="407" height="60" isPrintWhenDetailOverflows="true" uuid="1866fba3-4869-4d93-af0f-36422d16eccf">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="InvoiceDetailDS" uuid="4f1d98f2-fe87-477a-90b3-7524f0cab260">
<datasetParameter name="headerId">
<datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="93" uuid="7c67a26e-a635-4ddb-8406-4a2f9b225c87">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="93" height="30" backcolor="#A6FFB5" uuid="635a9e6c-697a-4637-b674-69aa8c753ed8"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Old SRF Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="93" height="30" isPrintWhenDetailOverflows="true" uuid="ef0042fa-17e5-4f0a-b1d1-d091bf1723db"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{OLDSRFNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="191" uuid="1410c880-6b1d-44c3-95a3-9bddc86bb688">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:tableFooter height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="191" height="30" backcolor="#A6FFB5" uuid="5001b005-2471-484a-9656-1886d2462ca1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Old Service Description]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter height="0" rowSpan="1"/>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="191" height="30" isPrintWhenDetailOverflows="true" uuid="e51f0035-cad9-4cc8-baef-06d208073ef5"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{OLDSERVICE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="07118eff-f7e7-4577-a4da-8c58e40ae256">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" backcolor="#A6FFB5" uuid="6d4ed900-1965-402a-adaf-731c484c93ee"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[New SRF Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="100" height="30" uuid="14c2da73-ebca-44a5-b6b5-ddaa50f4c360"/>
<box>
<topPen lineWidth="0.3"/>
<leftPen lineWidth="0.3"/>
<bottomPen lineWidth="0.3"/>
<rightPen lineWidth="0.3"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{SRFNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="332" uuid="587c3be8-0a7a-447e-b522-63b507e03f3e">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="332" height="30" backcolor="#A6FFB5" uuid="d571175e-3038-47b7-b9b8-a17e3ba7c271"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[New Service Description]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="332" height="30" isPrintWhenDetailOverflows="true" uuid="a3e861ee-40be-4c0c-bcc6-3fce102aa07c"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{DESCRIPTION}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
</band>
这是两个子报表包含在主报表中的方式:
<subreport>
<reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
</subreport>
我该如何解决这个问题?
编辑
尝试更改某些页面属性后,填充报告显示内存不足异常,搜索后我使用了虚拟程序但未解决。
SourceFileName = SourceFileName.replaceAll("//", "/");
JRVirtualizer virtualizer = new JRSwapFileVirtualizer(1000, new JRSwapFile(reportsDirString.replaceAll("//", "/"), 2048, 1024), true);
JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
// .replaceAll("\\", "\\")
parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);
Sub-reports 很少应该放在详细信息范围内,尽管偶尔会有正当理由这样做。
这样做的原因是 sub-reports 将针对主查询返回的每一行数据复制一次,例如如果您返回 1 行,您将获得每个子报表的 1 个副本,如果您返回 100 行,您将获得每个 sub-report 的 100 个副本。如果您的 sub-reports 也有 100 行,每个 sub-report 将返回 10k 行,并且很可能会遇到内存不足异常错误。
尝试将您的 sub-reports 移至 Header/Footer 带或摘要带,然后 运行 报告。
正如上面@philipobrien 所提到的,将子报表放在详细信息区段中通常是不正确的,除非您有意希望数据源返回每行一个新报表。
我建议使用允许多条带的 GroupFooter 部分。这些波段按照它们在 JRXML 中出现的顺序填充。
以下示例展示了如何将 GroupFooter 部分用于两个带区。据我所知,GroupFooter bands 会自动扩展它们的高度,因此无需专门设置高度,除非你当然想要一个最小高度。
请注意,我已从以下示例中删除了 GroupHeader 部分。在这种情况下,不需要此部分。还要注意用于确保组显示的虚拟表达式。
<group name="DUMMY_GROUP">
<groupExpression><![CDATA[0 == 0]]></groupExpression>
<groupFooter>
<band>
<subreport>
<reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
</subreport>
</band>
<band>
<subreport>
<reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
</group>
我有一个主报表,这个主报表包含两个子报表,
第一个子报表包含两个table,当第一个table上有很多数据时,它打印第一页成功,但其他页面为空。
预期的输出是继续显示第一个 table 的行,直到它转到第二个 table,如果没有大量数据它可以正常工作
这是设计代码:
<band height="429">
<staticText>
<reportElement x="13" y="5" width="100" height="60" uuid="b236e2f4-495e-4a22-87fa-4e316ea5f41f"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Account Number :]]></text>
</staticText>
<staticText>
<reportElement x="13" y="27" width="89" height="18" uuid="7fdc8df6-4c51-4d87-b8f7-cb0acec8acef"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Description :]]></text>
</staticText>
<staticText>
<reportElement x="13" y="47" width="80" height="21" uuid="294925d2-bf2a-4c51-9f8a-339873e0f747"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Period from :]]></text>
</staticText>
<textField>
<reportElement x="113" y="7" width="100" height="17" uuid="0406491b-1bdb-41db-8ece-4058578dc28a"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{CUSTOMERACCOUNTNUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="24" width="350" height="23" uuid="f3a441fe-3d57-490d-9d24-cd0d060694f3"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Summary invoice for "+ $F{COMPANYNAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="204" y="47" width="100" height="20" uuid="e71997f3-50fb-4736-8fdc-cd74d95204db"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{PERIODTO}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="174" y="47" width="30" height="20" uuid="bec9327c-65d8-4070-9b55-ddeaa6527e2f"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[ To:]]></text>
</staticText>
<textField>
<reportElement x="94" y="47" width="80" height="20" uuid="9e431304-75d4-43e6-9e7b-663a1dabf504"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{PERIODFROM}]]></textFieldExpression>
</textField>
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="20" y="-10" width="760" height="287" isPrintWhenDetailOverflows="true" uuid="81f11b41-36e2-4795-9965-02ae41b1b338"/>
<box>
<topPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<leftPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<bottomPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
<rightPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
</box>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="21" y="111" width="724" height="60" isPrintWhenDetailOverflows="true" uuid="6b9558ad-488a-4954-98f0-b4a4c19a3dbe">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="InvoiceDetailDS" uuid="d4a58f73-73e9-432a-bc4c-bc82959e3959">
<datasetParameter name="headerId">
<datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="95" uuid="52966a24-1f98-4445-b6f6-f83ada4ec1f8">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="868f2a68-0cba-47ce-9c30-f955deb28e85"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Service ID]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="4dce2c60-c99f-4752-9697-492e8e2d9930"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ORDERSERVICEID}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="92" uuid="bb1703e2-5b7e-4bef-9772-e40ee123a9bd">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="92" height="30" backcolor="#A6FFB5" uuid="56038351-cd7e-4c6d-9158-4d071e26faf8"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Order Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="92" height="30" uuid="f1d27619-7b71-407d-a449-f3bfa1906c93"/>
<box>
<topPen lineWidth="0.3"/>
<leftPen lineWidth="0.3"/>
<bottomPen lineWidth="0.3"/>
<rightPen lineWidth="0.3"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ROSNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="95" uuid="2703ba82-935b-496b-a4af-223f33a4a23c">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:tableFooter height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="f1fe79d1-2cea-42b1-88cb-1bc4e70ef6e1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Action Type]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter height="0" rowSpan="1"/>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="d512d971-c04f-4ecf-8a11-22b3fcbdffc0"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ACTIONTYPE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="479436d0-de8d-4cd6-9b8d-cc8f42eef53d">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="80" height="30" backcolor="#A6FFB5" uuid="9d46cd49-e847-4967-b69b-daa03cb3ed2f"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Invoice From]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="80" height="30" uuid="9b755792-0ce6-4144-985a-cf2f50e97c4b"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{INVOICEFROM}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="71" uuid="3b39699e-eeda-408c-a2af-d45125fe57ed">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="71" height="30" backcolor="#A6FFB5" uuid="5426229a-2a89-4335-aa9f-b42b51707041"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Invoice To]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="71" height="30" uuid="38071396-7786-4aec-ae98-64780811e474"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{INVOICETO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="101" uuid="6c5336a5-d796-469d-b843-f1062bf7f7ca">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="101" height="30" backcolor="#A6FFB5" uuid="49d8ab5c-272e-428d-b4c2-466c13d9a2b7"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Non-Recurring Charges]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="101" height="30" uuid="a93bc30f-13bc-4eaf-9cec-92849cc69756"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{NRC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="99" uuid="f2b13180-33c5-405d-883f-402c53c8cf20">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="99" height="30" backcolor="#A6FFB5" uuid="4cc22936-e12f-4bca-bb22-453d021d61c1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Recurring Charges]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="99" height="30" uuid="b5639d81-207e-432c-b3e0-793bf7dd533e"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{MRC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="d2a8e5ef-097b-4e8c-b0bd-84f8f2a272bd">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" backcolor="#A6FFB5" uuid="b2f75a95-5ac4-415b-b64b-05bcf3c77bef"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Amount SAR]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="30" uuid="0b9a5ef9-9e8a-406f-ab70-95d32ff00a40"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{TOTALAMOUNT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
</band>
</title>
<summary>
<band height="326">
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="130" y="120" width="760" height="206" isPrintWhenDetailOverflows="true" forecolor="#000000" uuid="1c3a92e7-b648-4580-acae-afb17ad5d59e"/>
<box>
<topPen lineWidth="2.0" lineColor="#20E827"/>
<leftPen lineWidth="2.0" lineColor="#20E827"/>
<bottomPen lineWidth="2.0" lineColor="#20E827"/>
<rightPen lineWidth="2.0" lineColor="#20E827"/>
</box>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="-89" y="-19" width="407" height="60" isPrintWhenDetailOverflows="true" uuid="1866fba3-4869-4d93-af0f-36422d16eccf">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="InvoiceDetailDS" uuid="4f1d98f2-fe87-477a-90b3-7524f0cab260">
<datasetParameter name="headerId">
<datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="93" uuid="7c67a26e-a635-4ddb-8406-4a2f9b225c87">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="93" height="30" backcolor="#A6FFB5" uuid="635a9e6c-697a-4637-b674-69aa8c753ed8"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Old SRF Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="93" height="30" isPrintWhenDetailOverflows="true" uuid="ef0042fa-17e5-4f0a-b1d1-d091bf1723db"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{OLDSRFNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="191" uuid="1410c880-6b1d-44c3-95a3-9bddc86bb688">
<jr:tableHeader height="1" rowSpan="1"/>
<jr:tableFooter height="1" rowSpan="1"/>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="191" height="30" backcolor="#A6FFB5" uuid="5001b005-2471-484a-9656-1886d2462ca1"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Old Service Description]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter height="0" rowSpan="1"/>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="191" height="30" isPrintWhenDetailOverflows="true" uuid="e51f0035-cad9-4cc8-baef-06d208073ef5"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{OLDSERVICE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="07118eff-f7e7-4577-a4da-8c58e40ae256">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" backcolor="#A6FFB5" uuid="6d4ed900-1965-402a-adaf-731c484c93ee"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[New SRF Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="100" height="30" uuid="14c2da73-ebca-44a5-b6b5-ddaa50f4c360"/>
<box>
<topPen lineWidth="0.3"/>
<leftPen lineWidth="0.3"/>
<bottomPen lineWidth="0.3"/>
<rightPen lineWidth="0.3"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{SRFNUMBER}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="332" uuid="587c3be8-0a7a-447e-b522-63b507e03f3e">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="332" height="30" backcolor="#A6FFB5" uuid="d571175e-3038-47b7-b9b8-a17e3ba7c271"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[New Service Description]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="332" height="30" isPrintWhenDetailOverflows="true" uuid="a3e861ee-40be-4c0c-bcc6-3fce102aa07c"/>
<box>
<topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{DESCRIPTION}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
</band>
这是两个子报表包含在主报表中的方式:
<subreport>
<reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
</subreport>
我该如何解决这个问题?
编辑
尝试更改某些页面属性后,填充报告显示内存不足异常,搜索后我使用了虚拟程序但未解决。
SourceFileName = SourceFileName.replaceAll("//", "/");
JRVirtualizer virtualizer = new JRSwapFileVirtualizer(1000, new JRSwapFile(reportsDirString.replaceAll("//", "/"), 2048, 1024), true);
JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
// .replaceAll("\\", "\\")
parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);
Sub-reports 很少应该放在详细信息范围内,尽管偶尔会有正当理由这样做。
这样做的原因是 sub-reports 将针对主查询返回的每一行数据复制一次,例如如果您返回 1 行,您将获得每个子报表的 1 个副本,如果您返回 100 行,您将获得每个 sub-report 的 100 个副本。如果您的 sub-reports 也有 100 行,每个 sub-report 将返回 10k 行,并且很可能会遇到内存不足异常错误。
尝试将您的 sub-reports 移至 Header/Footer 带或摘要带,然后 运行 报告。
正如上面@philipobrien 所提到的,将子报表放在详细信息区段中通常是不正确的,除非您有意希望数据源返回每行一个新报表。
我建议使用允许多条带的 GroupFooter 部分。这些波段按照它们在 JRXML 中出现的顺序填充。
以下示例展示了如何将 GroupFooter 部分用于两个带区。据我所知,GroupFooter bands 会自动扩展它们的高度,因此无需专门设置高度,除非你当然想要一个最小高度。
请注意,我已从以下示例中删除了 GroupHeader 部分。在这种情况下,不需要此部分。还要注意用于确保组显示的虚拟表达式。
<group name="DUMMY_GROUP">
<groupExpression><![CDATA[0 == 0]]></groupExpression>
<groupFooter>
<band>
<subreport>
<reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
</subreport>
</band>
<band>
<subreport>
<reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
<subreportParameter name="INVOICE_NO">
<subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
</group>