【问题标题】:how to set width of the report dynamically in ireport based on number of columns如何根据列数在 ireport 中动态设置报告的宽度
【发布时间】:2014-03-26 14:33:56
【问题描述】:

我可以根据它包含的数据设置jrxml报告的宽度吗?这意味着可以根据数据缩小或扩大报告大小。

我创建了最多 15 列用于报告并根据输入隐藏/显示所需的列。报告列被隐藏但页面宽度保持不变。

任何人都可以有所启发。提前致谢。

【问题讨论】:

    标签: jasper-reports ireport


    【解决方案1】:

    我终于找到了解决方案,.. 我们可以在设计时将 jrxml 页面宽度设置为 15 列的最大值(比如 1500)。 我们可以根据用户报告单独显示/打印所需的列(比如 10 个)。 我们可以在运行时使用 jasperprint.setPageWidth()

    设置页面宽度

    我已经做到了,...

    InputStream stream = ReportServlet.class.getResourceAsStream(file_location);
    JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(data);
    jasperReport = JasperCompileManager.compileReport(stream);
    jasperPrint = JasperFillManager.fillReport(jasperReport, hashMap,ds);
    int noOfColumns = 10;           
    jasperPrint.setPageWidth(noOfColumns * 100);
    

    【讨论】:

    • 非常感谢,不知道有这个方法存在jasperPrint.setPageWidth!!
    【解决方案2】:

    我从未设置此功能,但我会尝试查看 Print When Expression 属性。

    一个好的开始是查看文档 iReport 终极指南:http://community.jaspersoft.com/documentation,第 60 页。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多