首页 > 解决方案 > 在打印组后计算 JasperReports scriptlet 中的值

问题描述

我有以下 JasperReport 脚本,它工作正常:

public class ReportScriptlet extends JRDefaultScriptlet {

    public void beforeGroupInit(String groupName)  throws JRScriptletException {
        System.out.println("in beforeGroupInit - " + groupName);
    }

    public void afterGroupInit(String groupName)  throws JRScriptletException {
        System.out.println("in afterGroupInit - " + groupName);
    }

}

问题是在打印组的beforeGroupInitafterGroupInit之前运行,我需要在打印行之后进行计算。

既然没有afterGroupFinalized事件,有没有不同的方法来实现这一点?

标签: javajasper-reports

解决方案


为什么不使用 GroupFooter?您可以创建一个新变量,设置您的计算并在变量表达式中设置正确的字段


推荐阅读