【问题标题】:Not able to pass JTable to Jasper report无法将 JTable 传递给 Jasper 报告
【发布时间】:2012-10-03 21:48:15
【问题描述】:
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) 的内容..它只是在报告上显示两个粗体空标题行..任何人帮助..

【问题讨论】:

  • 代码中的 JTable 在哪里?您是否使用 JTable 作为报表模型?
  • jtable 是 tblstock(jtable 的变量名),它存在于同一个 java 文件中。jtable 填充了数据库中的数据。我已经参考了这些链接。但找不到解决方案..

标签: java swing jasper-reports jtable report


【解决方案1】:

请检查表格主体单元格中每个元素的字体大小和/或高度。您还必须检查模板 - 元素不能重叠。

【讨论】:

  • jtable 是 tblstock(jtable 的变量名),它存在于同一个 java 文件中。jtable 填充了数据库中的数据。我已经参考了这些链接。但找不到解决方案..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多