jasperreports子报告没有分裂 [英] jasperreports subreport not splitting

查看:125
本文介绍了jasperreports子报告没有分裂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个子报告的jasper报告。他们中的大多数工作正常,但由于某种原因,我的一个子报表如果变得足够长到达页面的末尾就不会分裂,而是会跳回到其详细信息部分的顶部并继续写入,覆盖之前的文本。我看不出这个子报告和工作正确的子报告之间有什么区别。目前我的项目使用jasper-reports 1.2.5,但我尝试升级到4.0.1(仅适用于这一个报告),结果是相同的。

I have a jasper-report that has several subreports. Most of them work fine, but for some reason one of my subreports does not split if it becomes long enough to reach the end of the page, instead it jumps back up to the top of its detail section and continues writing there, overwriting the previous text. I can't see any difference between this subreport and the one that work right. Currently my project uses jasper-reports 1.2.5, but I tried upgrading to 4.0.1 (just for this one report) and the results were the same.

这是jrxml中我的子报表不起作用的部分:

This is the section of jrxml where my subreport which doesn't work is included:

<subreport  isUsingCache="true">
<reportElement
    x="0"
    y="172"
    width="468"
    height="21"
    key="subreport-3"
    positionType="Float"/>
<dataSourceExpression><![CDATA[$P{dataSourcePreviousYukonLicence}]]></dataSourceExpression>
<subreportExpression  class="java.io.InputStream"><![CDATA[this.getClass().getResourceAsStream("/config/template/subreportPreviousYukonLicence2.jasper")]]></subreportExpression>

这是一个 工作:

<subreport  isUsingCache="true">
<reportElement
    x="0"
    y="43"
    width="468"
    height="21"
    key="subreport-2"
    positionType="Float"/>
<dataSourceExpression><![CDATA[$P{dataSourceConvictionHistory}]]></dataSourceExpression>
<subreportExpression  class="java.io.InputStream"><![CDATA[this.getClass().getResourceAsStream("/config/template/subreportConvictionHistory.jasper")]]></subreportExpression>

子报表本身非常相似设计,所有乐队都有 isSplitAllowed =true,他们使用相同的字体和相同类型的报告元素。

The subreports themselves are very similarly designed, with all the bands having is isSplitAllowed="true", and they ues the same fonts and the same types of report elements.

如果有人有任何想法,为什么一个人会正确分裂而另一个没有,你的帮助将非常感激。

If anyone has any ideas why one would split properly and the other not, your help woulb be much appreciated.

推荐答案

我们遇到了相同或至少非常相似的问题。原因不在报告中,而是在子报告的定义中。它被配置为具有多个列,当它到达报告的最后一行时,它再次在第二列的顶部开始。

We had the same or at least extremely similar problem. The cause wasn't in the report, but in the definition of the subreport. It was configured to have multiple columns and when it reached the last line of the report it startet again on the top in the second column.

将其设置为单列固定为。以下是我们案例中的简化增量

Setting it to single column fixed that. The following is the simplified delta in our case

-<jasperReport ... columnCount="3" pageWidth="240" pageHeight="555" ...>
+<jasperReport ...  pageWidth="240" pageHeight="555" ...>

如果子报表不适合当前页面,现在乐队将在下一页开始。

Now the band starts on the next page if the subreport doesn't fit on the current page.

这篇关于jasperreports子报告没有分裂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆