如何从不同的BIRT报告组中的1重新开始页码 [英] How to restart page number from 1 in different group of BIRT report

查看:203
本文介绍了如何从不同的BIRT报告组中的1重新开始页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景: 使用Java + BIRT生成报告. 在查看器中生成报告,并允许用户选择将其导出为其他格式(pdf,xls,word ...).

Backgroud: Use Java + BIRT to generate report. Generate report in viewer and allow user to choose to export it to different format (pdf, xls, word...).

所有程序均位于布局"中,而没有程序位于母版页"中. 有1个数据集". 布局"中的字段引用此DS. 在布局"中有分组,按一个字段可按组. 在组标题"中,我创建一个单元格用作页码. 页面:MyPageNumber". 我定义了"MyPageNumber"字段,该字段将在组标题中+1.

All program are in "Layout", no program in "Master Page". Have 1 "Data Set". The fields in "Layout" refer to this DS. There is Group in "Layout", gropu by one field. In "Group Header", I create one cell to use as page number. "Page : MyPageNumber". "MyPageNumber" is a field I define which would +1 in Group Header.

问题: 当我使用第一种方法生成报告时,"MyPageNumber"无法正确显示.因为组头仅为每个组加载一次.它总是显示1.

Problem: When I use 1st method to generate report, "MyPageNumber" could not show correctly. Because group header only load one time for each group. It would always show 1.

问题: 据我所知,Crystal报表中有组中重新启动页码".如何在BIRT中重新启动页面? 我想在1个报告文件中显示不同组的数据,并且每个组的页码从1开始.

Question: As I know there is "restart page number in group" in Crystal report. How to restart page in BIRT? I want to show data of different group in 1 report file, and the page number start from 1 for each group.

推荐答案

可惜,BIRT不支持此功能.

Alas, this is not supported with BIRT.

这可能不是您希望的答案,但这是事实. 这是BIRT远远落后于其他报表生成器工具的几个方面之一.

That's probably not the answer you've hoped for, but it's the truth. This is one of the very few aspects where BIRT is way behind other report generator tools.

但是,取决于将BIRT集成到环境中的方式,对于PDF导出,一种可行的解决方法是可行的,我们在解决方案中使用了这种方法,并取得了巨大的成功. 想法是让BIRT基于分组生成PDF轮廓. BIRT报表在ReportContext中创建有关希望在何处以及如何显示页码的信息. BIRT生成PDF后,自定义PDFPostProcessor将使用PDF轮廓和ReportContext中的信息来添加带有iText的页码. 如果您可以采用这种解决方法,请随时与我联系.

However, depending on how you have BIRT integrated into your environment, a workaround approach is possible for PDF export that we use in our solution with great success. The idea is to let BIRT generate a PDF outline based on the grouping. And the BIRT report creates information in the ReportContext about where and how it wants the page numbers to be displayed. After BIRT generated the PDF, a custom PDFPostProcessor uses the PDF outline and the information from the ReportContext to add the page numbers with iText. If this work-around is viable for you, feel free to contact me.

这篇关于如何从不同的BIRT报告组中的1重新开始页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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