【问题标题】:How to prevent repeating data in JasperReports TextField如何防止 JasperReports TextField 中的重复数据
【发布时间】:2014-10-14 17:30:28
【问题描述】:

我正在使用 JasperReports,但 textField 数据有一些问题,请在下一页继续。
我有 3 个 textField 详细带。
波段 splitType="Stretch"。
每个文本文件都有边框,并且 isPrintWhenDetailOverflows 参数设置为“true”。
当文本字段中的数据不适合页面时,它会继续下一个。所以我需要打印相同波段的其他文本文件(因为我需要打印每个文本字段的边框)
但是 isPrintWhenDetailOverflows="true 也会导致在第二页的其他文本字段中重复数据,尽管它们的内容适合第一页。

插图:

【问题讨论】:

  • 您是否为textField 设置了isStretchWithOverflow="true"textField里面reportElementstretchType属性值是多少?
  • 请提供您的文本字段的 jrxml 代码。

标签: jasper-reports


【解决方案1】:

碧玉报告文档说:

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.

所以我认为这可能是一个问题。 删除 isPrintWhenDetailOverflows="true"。在这种情况下,isStretchWithOverflow="true"stretchType="RelativeToTallestObject" 这两件事对我有用。所以你的textField 会是这样的:

<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> 

【讨论】:

  • stretchType="RelativeToTallestObject" no stretchType="RelativeToBandHeight" 都不能解决问题
  • 正如我在图片中看到的,textfield1textfield3 的内容不会在第二页上重复。这不是你想要的吗?关于边框,它只会包含文本,因为 textField 已经超出了它的预定义高度。我认为textfield1textfield3 的第二页也无法获得边框
猜你喜欢
  • 1970-01-01
  • 2018-12-29
  • 2013-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-11
  • 2012-11-03
相关资源
最近更新 更多