要隱藏和除去reportElement
上值中使用的printWhenExpression
和isRemoveLineWhenBlank="true"
(在所有需要被去除的文本框)
例
<textField pattern="#,##0;-#,##0" isBlankWhenNull="false">
<reportElement positionType="Float" x="453" y="22" width="97" height="16" isRemoveLineWhenBlank="true" uuid="e3279093-5beb-490a-9954-aad866ed208c">
<printWhenExpression><![CDATA[$V{vdisc_1}!=null&&$V{vdisc_1}.equals(0)]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$V{vdisc_1}]]></textFieldExpression>
</textField>
製作一個reportElement
(總行)浮起來,使用positionType="Float"
屬性
例
<staticText>
<reportElement positionType="Float" x="372" y="56" width="80" height="16" uuid="6ba40473-9efb-42e3-8b49-0d2c32ba84bd"/>
<textElement>
<font size="9"/>
</textElement>
<text><![CDATA[Total (Rp)]]></text>
</staticText>
無需離開空白,如果文本框飄起來自然有更多的空間下,你可以不是簡單的一套動態的高度一個樂隊。
實現動態高度的最簡單方法是將所有文本(在lastPageFooter中)移動到子報表中(例如通過參數傳遞所需的數據)。包括這個報表與最小高度並設置其positionType="FixRelativeToBottom"
例
<subreport>
<reportElement positionType="FixRelativeToBottom" x="0" y="87" width="555" height="41" uuid="656195bf-74bc-4aa0-9f0a-9c3a00cc6fb2"/>
<subreportParameter name="vdisc_1">
<subreportParameterExpression><![CDATA[$V{vdisc_1}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "example_subreport.jasper"]]></subreportExpression>
</subreport>
哪裏是你的問題?你能發佈你的jrxml文件嗎? – sanluck
@Jackie [JasperReports/iReport Designer:我可以有條件地顯示一個band]的可能的副本(http://stackoverflow.com/q/17524212/876298)&[如何根據返回值同一頻段的子報告](http://stackoverflow.com/q/35293689/876298)。同樣的想法 –
@Jackie這個問題還是開放的嗎?你還有麻煩嗎? –