0
我的.jrxml文件包含2文本和一個PARAMjava的碧玉PARAMS靜態
以下爲碧玉報告我的Java代碼,當我運行的代碼,它創建的PDF文件,但它始終是空的任何幫幫我 ?
public class TestReport {
public static void runReport(String reportFile) {
try{
Map parameters = new HashMap();
parameters.put("my_var", "Address Report");
JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jsp = JasperFillManager.fillReport(jasperReport, parameters);
JasperExportManager.exportReportToPdfFile(jsp, "/home/ireports/test1.pdf");
}catch(Exception ex) {
String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage();
System.out.println(connectMsg);
}
}
public static void main(String args[]){
runReport("/home/ireports/report1.jrxml");
}
}