【问题标题】:How to set The values in Jasper report如何设置 Jasper 报告中的值
【发布时间】:2015-09-24 08:32:23
【问题描述】:

如何设置来自不同表的页脚部分的 Jasper 报告中的值?我的意思是说页脚部分有三行,我正在从视图中获取数据。现在我的要求是在不同的页脚行中显示来自不同表的页脚部分的数据(例如 - 即三行我使用三个表)?

【问题讨论】:

  • 如果你用一张你期望的小图片更清楚地发布你的问题会很好

标签: jasper-reports


【解决方案1】:

如何将值作为参数传递?

Java 端

// Call SQL here.
// select value1, value2, value3 from footer_table where ....

Map paramMap = new HashMap();
paramMap.put("value1", "the footer value1");
paramMap.put("value2", "the footer value2");
paramMap.put("value3", "the footer value3");

JasperPrint print = JasperFillManager.fillReport(jasper, paramMap, connection);

// Export to PDF
JasperExportManager.exportReportToPdfFile(print, PdfPath);

碧玉面

1.添加参数。

name: value1
Parameter Class: java.lang.String

2.将 TextFields 放在页脚并设置 Text Field Expression。

$P{value1}
$P{value2}
$P{value3}

【讨论】:

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