How to prevent repeating data in JasperReports Tex

2019-02-15 14:30发布

I am using JasperReports and have some problem with textField data continue on next page.
I have 3 textField in detail band.
Band splitType="Stretch".
Every textfiled has borders and isPrintWhenDetailOverflows param set "true".
When data in textfield does not fit on page it continues on next. So i need to print other textfileds of same band (because i need to print borders of every textfield)
But isPrintWhenDetailOverflows="true also leads to repeating data in other textfields on second page though their contents fits on first page.

Illustration:

enter image description here

1条回答
放我归山
2楼-- · 2019-02-15 15:25

The jasper report documentation says:

isPrintWhenDetailOverflows()
If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.

So I think it might be a problem. Remove isPrintWhenDetailOverflows="true". The two things isStretchWithOverflow="true" and stretchType="RelativeToTallestObject" are working for me in this case. So your textField will be like:

<textField isStretchWithOverflow="true" isBlankWhenNull="true">
   <reportElement style="cell" stretchType="RelativeToTallestObject" x="266" y="0" width="266" height="15"/>
   <textElement textAlignment="Left" verticalAlignment="Middle">
     <font fontName="Arial" size="9" isBold="false" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
     <paragraph leftIndent="2"/>
   </textElement>
   <textFieldExpression><![CDATA[$F{structure}]]></textFieldExpression>
</textField> 
查看更多
登录 后发表回答