private void txtPrintActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
JasperCompileManager.compileReportToFile("../report/report2.jrxml");
JasperPrint jasperPrint=JasperFillManager.fillReport("../report/report2.jasper",new HashMap(),new JRTableModelDataSource(tblStock.getModel()));
JasperViewer jasperviewer=new JasperViewer(jasperPrint);
jasperviewer.setVisible(true);
}
catch(Exception e) {
System.out.println("Exception in generating report,generateReport() of JasperReportGenerator:"+e);
}
}
使用此代码生成的 Jasper 报告不显示 JTable (tblStock) 的内容..它仅在报告上显示两个粗体空标题行..任何人帮助..