2013-10-02 75 views
2

我正在使用iReport 4.5.1來設計JR pdf報告。我正在使用框架組件來分組報表中的幾個字段。我在框架上使用「Print When Expression」選項時只在特定字段不爲空時顯示它。當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> 

回答

3

默認情況下隱藏的元素留下空白空間。爲了避免這種情況,您應該在元素上設置屬性isRemoveLineWhenBlank爲true,在這種情況下爲框架。

但是,如果有其他元素共享相同的行並且可見,則不可能摺疊該空間。