Jasper子报表未显示

问题描述 投票:0回答:1

我创建了一个非常简单的子报告“ dummy_subreport.jrxml”,该报告将打印静态文本。dummy_subreport.jasper包含在报告“ Calling_report.jrxml”中,该报告还会打印静态文本并包含子报告。

但是,在调用主报表时,子报表没有显示。

子报告代码为



<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-                                      75c5e90a222ab406e416cbf590a5397028a52de3  -->
<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="dummy_subreport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20"            rightMargin="20" topMargin="20" bottomMargin="20" uuid="6447fcf5-f45c-4ec9-9856-9e71d007fe25">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <pageHeader>
        <band height="50">
            <staticText>
                <reportElement x="90" y="0" width="286" height="30" uuid="da6a5133-0346-47b1-9670-08181c7c4015"/>
                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                <text><![CDATA[From sub report]]></text>
            </staticText>
        </band>
    </pageHeader>
    <detail>
        <band height="125" splitType="Stretch"/>
    </detail>
</jasperReport>

主叫报告是

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-                                      75c5e90a222ab406e416cbf590a5397028a52de3  -->
<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="Calling_report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20"                  bottomMargin="20" uuid="2d974f9a-a58b-4dfd-a321-08b484ad8079">
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="61" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="133" splitType="Stretch">
            <staticText>
                <reportElement x="60" y="12" width="410" height="30" uuid="cf8b21d2-bfc3-4e50-81d9-c96e8af4e128"/>
                <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None"/>
                <text><![CDATA[HELLO WORLD IN THE COVERING REPORT]]></text>
            </staticText>
            <subreport>
                <reportElement x="261" y="58" width="200" height="52" uuid="f09ee64a-f8ed-478c-9338-92e251d751c2"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
                <subreportExpression><![CDATA["dummy_subreport.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>

非常感谢这方面的任何帮助。

jasper-reports subreport
1个回答
0
投票

更改为

<subreportExpression><![CDATA["dummy_subreport.jrxml"]]></subreportExpression>
© www.soinside.com 2019 - 2024. All rights reserved.