Jasper Reports - 从子报表中删除 pageHeader/columnHeader

发布于 2024-11-27 03:51:30 字数 1110 浏览 0 评论 0原文

我有一个主报告和两个子报告。我使用相同的报告来生成 PDF 和 xls。分页已启用,但对于 Excel,我需要禁用分页,这是通过将所有内容呈现在一张纸中来实现的。每页都会重复页眉/列标题。这些页眉/列标题来自子报告。这对于 PDF 来说很好,但对于 Excel,我想去掉重复的标题。 我设置了这些属性:

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.pdf.exclude.origin.keep.first.band.1" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />

但这些属性没有反映在子报表呈现的数据中。在 xls 中,我仍然看到 pageHeader/columnHeader 被重复。请让我知道如何解决这个问题。

I have a master report with 2 subreports. I use the same report to generate PDF and xls. Pagination is enabled but for excel, i need to disable pagination, which i do by rendering all in one sheet. The page header/column header get repeat for each page. These page header/column header are from the sub reports. This is fine for PDF but in case of excel, i want to get rid of the repeating header.
I set these properties:

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.pdf.exclude.origin.keep.first.band.1" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />

But these arent reflected in the data rendered by the subreport. In xls, i still see the pageHeader/columnHeader gets repeated. Please let me know, how to fix this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天荒地未老 2024-12-04 03:51:30

对于 XLS(和 HTML)报告,您可能需要将参数 IS_IGNORE_PAGINATION 设置为 true。请参阅http://jasperreports.sourceforge.net/api/net/ sf/jasperreports/engine/JRParameter.html 查看文档。

For XLS (and HTML) reports, you may want to set the parameter IS_IGNORE_PAGINATION to true. See http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRParameter.html for documentation.

孤独患者 2024-12-04 03:51:30

我知道这是一个老问题,但我一直忘记自己如何做到这一点,每次搜索时我似乎都找到了这个问题,所以我想我应该放一些东西,以便下次找到它。

在主报告文件中,您还需要将子报告添加到过滤器:

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" /> 
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.1" value="sub-report-name" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.report.1" value="sub-report-name" /> 

I know this is an old question, but I keep forgetting how to do this myself and each time I search I seem to find this question so thought I'd put something so I find it next time.

In the main report file you also need to add the sub report to the filter:

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" /> 
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.1" value="sub-report-name" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.report.1" value="sub-report-name" /> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文