尝试了下面的代码,但没有生成 PDF 报告。刚开始使用 Jasper integartion。请帮忙。
public String mainReport() {
HashMap jrxmlParams = null;
try {
System.out.println("Start ....");
// Get jasper report
String jrxmlFileName = "C:/Jasper/DP_crosstabs.jrxml";
JasperReport objJReport = JasperCompileManager.compileReport(jrxmlFileName);
connection = getConnection();
jrxmlParams = new HashMap();
jrxmlParams.put("ID", "null");
JasperPrint objJPrint = JasperFillManager.fillReport(objJReport, jrxmlParams, connection);
ByteArrayOutputStream objBAOutputStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(objJPrint, objBAOutputStream);
System.out.println("Done exporting reports to pdf");
} catch (Exception e) {
System.out.print("Exceptiion" + e);
}
return null;
}