如何在Jaspersoft iReport Designer 4.7中添加第二页 [英] How do I add a second page in Jaspersoft iReport Designer 4.7

查看:1316
本文介绍了如何在Jaspersoft iReport Designer 4.7中添加第二页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我对使用Jaspersoft iReport Designer完全陌生。我想要一份有两页的报告。我使用的版本是4.7.0。我已经有一个页面上有相关信息,但我不知道如何添加第二页。任何帮助将不胜感激。谢谢您的时间。

Hello I'm completely new to using Jaspersoft iReport Designer. I want to have a report with two pages. The version I'm using is 4.7.0. I already have one page with information on it but I have no clue how to add a second page. Any help will be appreciated. Thank you for your time.

推荐答案

您可以通过以下几种方式完成此任务。

You can accomplish this a couple ways.


  • 第一种是实际创建2个单独的报告并合并它们。基本上,您将每个页面绘制成您想要的样子。在导出时,您将创建报告的2个JasperPrint实例,然后批量导出它们。

  • The first is actually creating 2 separate reports and merging them. Basically you draw out each page how you want it to look. On export, you create the 2 JasperPrint instances of the report, and then batch export them.

public byte[] generateReport(JasperPrint jasperPrint1, JasperPrint jasperPrint2) {
  //throw the JasperPrint Objects in a list
  List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
  jasperPrintList,add(jasperPrint1);
  jasperPrintList,add(jasperPrint2);


  ByteArrayOutputStream baos = new ByteArrayOutputStream();     
  JRPdfExporter exporter = new JRPdfExporter();     
  //Add the list as a Parameter
  exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
  //this will make a bookmark in the exported PDF for each of the reports
  exporter.setParameter(JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, Boolean.TRUE);
  exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);       
  exporter.exportReport();      
  return baos.toByteArray();
}


  • 第二个选项是转到子报告路线。基本上,您创建报告的第一页。然后,您创建报告的第二页。然后在iReport中,您可以将子报表添加到Summary Band中,传递它需要运行的任何所需信息(即数据库连接,数据源,参数等)。在整个报告的属性下,您需要确保选择新页面上的摘要,以便子报表将在其自己的页面上打印。

  • The second option is to go the Subreport route. Basically you create the first page of the report. Then you create the second page of the report. Then in iReport you can add the subreport in to Summary Band, passing any needed information that it needs to run (i.e Database Connection, datasource, parameters, etc.). Under the properties for the overall report you will want to make sure Summary on new page is selected so that the the subreport will print on its own page.

    这篇关于如何在Jaspersoft iReport Designer 4.7中添加第二页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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