Jasper子报表大小调整问题

问题描述

寻找解决我困境的最佳方法。我正在构建报告,正在使用的数据源是JSON

这就是数据通过JSON传递给我的样子

Parent
    Child
        Child (NEED SOME FIELDS HERE FOR HEADER)
             FINAL CHILD (Need Fields In Here) (Setup as array bc multiple of Final Child)
             FINAL CHILD
             FINAL CHILD and so on (FINAL CHILD will be repeating in the Detail section.)
               ALSO FINAL CHILD IS SETUP IN ARRAY FOR EACH FINAL CHILD

当前,我已经建立了一个主报表和子报表。我不需要传递任何数据,因为父级只有几个孩子……但是在主报告的详细信息部分将遍历所有“最终子级”的地方无法正常工作。

主报告预览:

Master Report Preview

子报表预览:

SubReport Preview

无论我对施胶进行什么操作,都无法缩小尺寸和紧凑度...

主报告代码

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<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="Test4BD" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="65794bef-41ec-4ebe-9237-6c5db5cb403c">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="BD JSON Data Adapter"/>
    <queryString language="json">
        <![CDATA[tXML.Message.InboundReportXML.MESSAGEDATA.ASNDATA.INBOUNDHEADER]]>
    </queryString>
    <field name="ASNID" class="java.lang.String">
        <fieldDescription><![CDATA[ASNID]]></fieldDescription>
    </field>
    <field name="ASN" class="java.lang.String">
        <fieldDescription><![CDATA[ASN]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="7" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="14" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="62" splitType="Stretch">
            <textField>
                <reportElement x="70" y="0" width="100" height="30" uuid="0f247a53-6ea3-462d-a655-0e3f02f2b611"/>
                <textFieldExpression><![CDATA[$F{ASNID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="330" y="0" width="100" height="30" uuid="2c72da14-4800-4d2c-af67-58d27232133d"/>
                <textFieldExpression><![CDATA[$F{ASN}]]></textFieldExpression>
            </textField>
        </band>
    </columnHeader>
    <detail>
        <band height="75" splitType="Stretch">
            <subreport>
                <reportElement x="40" y="0" width="460" height="70" uuid="684434fc-a528-4e65-b7e8-6192048ae611"/>
                <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
                <subreportExpression><![CDATA["SubReport2.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

子报告:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<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="SubReport2" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2d15bbaf-6da1-4158-83b1-6a069fa6144b">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="BD JSON Data Adapter"/>
    <queryString language="json">
        <![CDATA[tXML.Message.InboundReportXML.MESSAGEDATA.ASNDATA.INBOUNDHEADER.INBOUNDDETAILS]]>
    </queryString>
    <field name="ASNDETAILID" class="java.lang.String">
        <fieldDescription><![CDATA[ASNDETAILID]]></fieldDescription>
    </field>
    <field name="LINENBR" class="java.lang.String">
        <fieldDescription><![CDATA[LINENBR]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="8" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="9" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="32" splitType="Stretch">
            <staticText>
                <reportElement x="84" y="0" width="100" height="30" uuid="3b17e526-5b45-45db-b75f-4a86a1608bec"/>
                <text><![CDATA[ASNDETAILID]]></text>
            </staticText>
            <staticText>
                <reportElement x="310" y="0" width="100" height="30" uuid="cd6e9ad5-60a5-4041-894d-970faa1d4bd5"/>
                <text><![CDATA[LINENBR]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="33" splitType="Stretch">
            <textField>
                <reportElement x="70" y="0" width="100" height="30" uuid="e8036cc3-bddc-47d7-9686-bbea50bc7f1c"/>
                <textFieldExpression><![CDATA[$F{ASNDETAILID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="210" y="0" width="100" height="30" uuid="5f3a97c2-6f8e-4458-8f9e-c13890a6b308"/>
                <textFieldExpression><![CDATA[$F{LINENBR}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="10" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="7" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="8" splitType="Stretch"/>
    </summary>
</jasperReport>

我愿意接受所有建议...同样,对JSON和Jasper的使用经验很少...尤其是在子报表方面...我希望我什至不需要子报表。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)