本文介绍了如何在Jasper中使用子报表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里做错了什么?

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    subreport_dir = "...\\Report\\subReport.jasper";
    try {
        compileView("...\\Report\\myReport.jrxml");
    } catch (JRException ex) {
        JOptionPane.showMessageDialog(this, "No Row");
        System.out.println(ex.toString());
    }
}

当我调用函数时

private static void compileView(String path) throws JRException {
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("month", myMonth);
    param.put("year", myYear);
    param.put("SUBREPORT_DIR", subreport_dir);
    param.putAll(param);
    JasperReport jRp = JasperCompileManager.compileReport(path);
    JasperPrint jPrint = JasperFillManager.fillReport(jRp, param, getConnection());
    JasperViewer.viewReport(jPrint, false);
    JasperViewer.setDefaultLookAndFeelDecorated(true);

}

我收到此异常:

我该怎么办?

推荐答案

在报告中的<jasperReport>标记上更改语言标记

Change the language tag in your report on the <jasperReport> tag

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="subreport" language="groovy" pageWidth="555" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6afeba62-b470-4dfb-a8fb-42e2226b906d">

language ="groovy"

language ="java"

这篇关于如何在Jasper中使用子报表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 21:20