JasperReports:封面 [英] JasperReports: Cover page

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

问题描述

我有一个JasperReport,我想为此报告创建一个封面。
封面页必须包含来自数据库的一些信息,如公司名称等。
我试图使用子报表执行此操作,但我没有成功。
我创建了一个主报告,首先包含封面作为子报告,然后
将整个报告作为第二个子报告。我得到了一个空的报告。

I have a JasperReport and I want to create for this report a cover page. The cover page must contain some information coming from the DB, like Company name, etc. I am trying to do this using a subreport but I didn't succeed. I've created a main report which contains first the cover page as a subreport and then the whole report as a second subreport. I got an empty report.

我的第二次尝试是将封面作为子报告放入主报告中,但是
这个也没有用。

My second try was to put inside the main report the cover page as a subreport but this didn't work as well.

任何提示怎么做?



非常感谢提前。


Thanks a lot in advance.

推荐答案

目录话语

设定使用Jasper Reports,使用子报表并非易事。至少有两种方法可以告诉主报告在哪里查找子报告。

Setting up the subreport is not trivial using Jasper Reports. There are at least two ways to tell a master report where to find sub-reports.


  1. SUBREPORT_DIR 参数。

  2. 将子报告放在CLASSPATH中。

  1. Provide a value for the SUBREPORT_DIR parameter.
  2. Place the subreports within the CLASSPATH.

对于解决方案1,请确定运行时主报表位置的绝对目录。然后,将子报表放在主报表下的相对目录中。最后,告诉主报告包含子报告的子目录的绝对路径。

For solution 1, determine the absolute directory of the master report location at run time. Then, place subreports in relative directories under the master report. Finally, tell the master report the absolute path to the subdirectory containing the subreports.

我没有使用解决方案2.

I have not used solution 2.

参数化大师

考虑参数化主报告,而不是创建子报告。

Consider parameterizing the master report, instead of creating subreports.


  1. 在报告中添加参数列表。

  2. 将参数拖到报告标题上。

如果您只有一个报告,但想要使用不同的徽标(以及公司名称,样式等),则使用参数来配置外观。

If you only have one report, but want to use a different logo (and company name, styling, and so forth), then use parameters to configure the look and feel.

子报告使用

我发现在对数据进行查询时创建子报告很有用几乎相同,但需要以稍微不同的方式对数据进行分组。主报告包含所有常见内容(显示输入参数 - 以便可以重新创建报告,标题,公司名称,用户名,时间戳,页码等),子报告关注差异。通常,子报表将重叠并且仅根据输入参数的值执行。

I find it useful to create subreports when the queries for the data are nearly the same, but need to group the data in slightly different ways. The master report contains everything that is common (showing input parameters -- so that the report can be recreated, headings, company name, user name, time stamp, page number, and so on), and the subreports focus on the differences. Often, the subreports will overlap and only be executed depending on the value of an input parameter.

这篇关于JasperReports:封面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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