简体   繁体   English

使用iReport 5的空白子报表

[英]Blank subreport using iReport 5

Why my subreport it isn't shown? 为什么我的子报表没有显示? Look, the JRXML code is very simple. 看,JRXML代码非常简单。 When I press the view button in iReport only the main report is shown. 当我按iReport中的查看按钮时,仅显示主报告。 The two subreports aren't shown. 没有显示两个子报表。 Any help is welcome. 欢迎任何帮助。

report1_subreport1.jrxml:contains only a static text in the title band report1_subreport1.jrxml:标题栏中仅包含静态文本

<?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="report1_subreport1"language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="05f9b4fc-35fa-4335-8fd3-a02a78526a7c">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <title>
        <band height="79" splitType="Stretch">
            <staticText>
                <reportElement uuid="b9a3b1af-3d85-4902-a374-0674a0ea5c9f" x="0" y="7" width="218" height="72"/>
                <textElement/>
                <text><![CDATA[Mensage1]]></text>
            </staticText>
        </band>
    </title>
</jasperReport>

report1.jrxml : contains a static text and two subreports, the same defined early. report1.jrxml:包含一个静态文本和两个子报表,它们在早期定义相同。

<?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="report1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" uuid="cb5ca789-5eeb-4fce-914b-626d1da98104">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
    <defaultValueExpression><![CDATA["/home/david/teste/"]]></defaultValueExpression>
</parameter>
<queryString language="XPath">
    <![CDATA[]]>
</queryString>
<title>
    <band height="61" splitType="Stretch">
        <subreport>
            <reportElement uuid="b762ee33-6259-4103-92c0-f0dda0139a2f" x="0" y="0" width="555" height="61"/>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "report1_subreport1.jasper"]]></subreportExpression>
        </subreport>
    </band>
</title>
<columnHeader>
    <band height="61" splitType="Stretch">
        <textField>
            <reportElement uuid="af42ea5b-3b1e-4701-8077-6bd72597c929" x="0" y="0" width="555" height="61"/>
            <textElement/>
            <textFieldExpression><![CDATA["Main Message"]]></textFieldExpression>
        </textField>
    </band>
</columnHeader>
<detail>
    <band height="61" splitType="Stretch">
        <subreport runToBottom="false">
            <reportElement uuid="b762ee33-6259-4103-92c0-f0dda0139a2f" x="0" y="0" width="555" height="61"/>
            <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "report1_subreport1.jasper"]]></subreportExpression>
        </subreport>
    </band>
</detail>
</jasperReport>

I figure out the problem. 我找出问题所在。

The fields "When no data" were set to "no pages" and should be "All Section, No Detail". 字段“无数据时”设置为“无页面”,应为“所有部分,无详细信息”。 Another reason is the second subreport is in deatail band thus won't be printed. 另一个原因是第二个子报表处于deatail区域中,因此不会被打印。 I didn't test in runtime, only in iReport however i think it will run. 我没有在运行时中进行测试,仅在iReport中进行了测试,但是我认为它会运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM