如何防止JasperReports中的详细信息区域之间进行页面拆分 [英] How to prevent page split between details band in JasperReports

查看:111
本文介绍了如何防止JasperReports中的详细信息区域之间进行页面拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有两个详细区域的报告.第一个带显示图像,第二个带显示其文件名.但是,有时图像会以这样一种方式放入页面中,使得下面的文本行没有剩余的空间.文件名将转到下一页,看起来很傻:

I have a report with two detail bands. First band shows an image, second shows its filename. However, on an occasion, an image would fit into a page in such a way that there is no place left for the text line below. And the filename would go to the next page, which looks quite silly:

  some other contents

     +-------------------+
     |                   |
     |                   |       Page 1
     |                   |
     |                   |
     +-------------------+

  ----------------------------------------------

     foto.jpg                    Page 2

是否有一种方法可以防止在JR中发生此类分裂? IE.我希望在记录之间进行分页,但不要在同一记录的不同明细区域之间进行分页.在上面的用例中,图像及其文件名都应转到下一页:

Is there a way to prevent such splits in JR? I.e. I would like page split to occur between records, but not between different detail bands of the same record. In the usecase above, both image and its filename should go to the next page:

  some other contents            Page 1

  ----------------------------------------------

     +-------------------+
     |                   |
     |                   |
     |                   |       Page 2
     |                   |
     +-------------------+
     foto.jpg

在第二个详细区域将拆分类型设置为预防"似乎没有帮助...

Setting split type to "Prevent" on the second detail band doesn't seem to help...

推荐答案

您可以在报告中添加虚拟"组.

You can add a "dummy" group to your report.

添加具有常量表达式的组(例如true).

Add a group with a constant expression (like true).

取消勾选选项Add the group headerAdd the group footer.您可能不需要这些.

Untick options Add the group header and Add the group footer. You probably don't need those.

现在有两种防止分裂的方法:

Now there are two ways to prevent the split:

  1. 在组选项下,勾选名为Keep Together的属性.在早期版本的Jasper Reports中,它并不总是能正常工作.也许现在会更好.
  2. 在组选项下,有一个名为Min Height To Start New Page的属性.将其值设置为两个细节区域的高度之和.然后,无论何时打印该组,Jasper Reports都会检查页面中的剩余空间是否大于或等于该属性.如果没有,它将在新页面上打印该组.
  1. Under group options, tick the property called Keep Together. It didn't always work properly in earlier versions of Jasper Reports. Maybe it's better now.
  2. Under group options, there is a property called Min Height To Start New Page. Set its value to the sum of the heights of both detail bands. Then, whenever it will print the group, Jasper Reports will check if the remaining space in the page is greater than or equal to that property. If not, it will print the group on a new page.

这篇关于如何防止JasperReports中的详细信息区域之间进行页面拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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