我有 1 个mainreport.xrml,这个报告有一个subreport.xrml。
因此,当我编译我的报告而不给报告提供任何对我的子报告的引用时,它会很好地生成我的报告,但是当我将report.xrml中的引用提供给我的subreport时,它会询问我的subreport.jasper
这是我进行编译的java代码:
JasperReport report = null;
JasperReport report2 = null;
JasperPrint jasperPrint = null;
StringBuilder pathReport = new StringBuilder();
try {
name = config.getProperty(Constants.PATH_JRXML) + name + SUFFIX;
String name2 = "";
if (tipoReporte.equals("mensual")) {
} else {
int a = 0;
name2 = "C:\\mail\\reporteIncidenciasDiarias.jrxml";
report2 = JasperCompileManager.compileReport(name2);
}
report = JasperCompileManager.compileReport(name);
jasperPrint = JasperFillManager.fillReport(report, mapParams,
new JRBeanCollectionDataSource(params));
pathReport.append(config.getKeyValue(Constants.PATH_REPORT));
String nombreReporte = config.getKeyValue(Constants.NAME_REPORT);
if (tipoReporte.equals("mensual")) {
nombreReporte += "Mensual";
} else {
nombreReporte += "Diario";
}
pathReport.append(nombreReporte);
pathReport.append(DateUtils.formatear(new Date(), Constants.PATTERN_DATE_2));
pathReport.append(Constants.FILE_EXT);
JasperExportManager.exportReportToPdfFile(jasperPrint, pathReport.toString());
logger.info("Reporte generado " + pathReport);
} catch (JRException e) {
logger.error(e);
throw new Exception(e);
} catch (Exception ex) {
logger.error(ex);
throw new Exception(ex);
}
return pathReport.toString();
我应该怎么做,它不会问我subreport.jasper或者我怎样才能得到我的subreport.jasper?