子报表未显示

时间:2011-08-16 11:22:30

标签: java jasper-reports

我开始使用JapserReports中的子报表。一开始我想做一些非常简单的事情。 这是我的子报告的xml代码:

    <?xml version="1.0" encoding="UTF-8"?>
<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="Rb50dane" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="0" bottomMargin="0">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <field name="column01" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band splitType="Stretch"/>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="22" splitType="Stretch">
            <textField>
                <reportElement x="208" y="0" width="257" height="22"/>
                <box>
                    <pen lineWidth="3.25"/>
                    <topPen lineWidth="3.25"/>
                    <leftPen lineWidth="3.25"/>
                    <bottomPen lineWidth="3.25"/>
                    <rightPen lineWidth="3.25"/>
                </box>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{column01}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>

这是我的主要报告代码的一部分:

<detail>
        <band height="22" splitType="Stretch">
            <subreport>
                <reportElement x="208" y="0" width="257" height="22"/>
                <dataSourceExpression><![CDATA[]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["C:\\Users\\mg\\Jasper\\Rb50data.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>

如您所见,我的子报表中不使用任何参数。不幸的是,在编译主报表后的iReport中,子报表没有显示,但是当我尝试单独运行子报表时,它可以工作。

在我的测试中,我使用空数据源。我只想查看具有null值的列,以确定子报表是否正常工作。

1 个答案:

答案 0 :(得分:1)

我会尝试在父报告的dataSourceExpression中添加一些内容。也许使用*

发送整个数据源
相关问题