2

我正在使用iReport 4.5.1来设计JR pdf 报告。我正在使用框架组件对报告中的几个字段进行分组。而且我在框架上使用“当表达式时打印”选项仅在特定字段不为空时显示它。

在生成的 PDF 报告中,当字段不为空时,Frame 和数据显示正常。但是当它为空时,框架不会显示在 PDF 上,而是留下一个巨大的空白空间。我无法想出避免这种情况的方法。

如果有人已经找到解决方案,请告诉我。

这是粘贴在下面的 JRXML 的一部分。

<frame>
    <reportElement positionType="Float" x="11" y="90" width="544" height="120" isPrintWhenDetailOverflows="true">
        <printWhenExpression><![CDATA[$F{facutlyMinimumTot} != null]]></printWhenExpression>
    </reportElement>
    <staticText>
        <reportElement positionType="Float" mode="Transparent" x="0" y="0" width="544" height="20" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true">
            <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
        </reportElement>
        <textElement>
            <font fontName="Arial" size="16" isBold="true"/>
        </textElement>
        <text><![CDATA[Time on Task]]></text>
    </staticText>
    <staticText>
        <reportElement positionType="Float" x="0" y="25" width="544" height="15"/>
        <textElement>
            <font fontName="Arial" size="10" isBold="true"/>
        </textElement>
        <text><![CDATA[Reading and Assignments]]></text>
    </staticText>
    <textField>
        <reportElement positionType="Float" x="0" y="40" width="544" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA["Minimum Requirement: "+$F{facutlyMinimumTot}]]></textFieldExpression>
    </textField>
    <textField>
        <reportElement positionType="Float" x="0" y="55" width="544" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA["This Syllabus has "+ $F{facutlyAllActivityTot}]]></textFieldExpression>
    </textField>
    <staticText>
        <reportElement positionType="Float" x="0" y="75" width="544" height="15"/>
        <textElement>
            <font fontName="Arial" isBold="true"/>
        </textElement>
        <text><![CDATA[Participation and other course-work
    ]]></text>
    </staticText>
    <textField>
        <reportElement positionType="Float" x="0" y="90" width="544" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA["Minimum Requirement: "+$F{studentMinimumTot}]]></textFieldExpression>
    </textField>
    <textField>
        <reportElement positionType="Float" x="0" y="105" width="544" height="15"/>
        <textElement/>
        <textFieldExpression><![CDATA["This Syllabus has " +$F{studentAllActivityTot}]]> </textFieldExpression>
    </textField>
</frame>
4

1 回答 1

3

默认情况下,隐藏元素会留下空白区域。为避免这种情况,您应该isRemoveLineWhenBlank在元素上将属性设置为 true,在本例中为框架。

但是,如果有其他元素共享同一行并且可见,则无法折叠空间。

于 2013-10-03T16:23:57.477 回答