开发者

JTable contents and database table in one report

开发者 https://www.devze.com 2023-01-25 10:15 出处:网络
I am new to JasprReports. I learned to get JTable contents to JasperReport using, JasperFillManager.fillReport(jasperReport, new HashMap(), new JRTableModelDataSource(table.getModel()));

I am new to JasprReports. I learned to get JTable contents to JasperReport using,

JasperFillManager.fillReport(jasperReport, new HashMap(), new JRTableModelDataSource(table.getModel()));

and get Oracle SQL contents to the report using,

JasperFillManager.fillReport(jasperReport, new HashMap(), connection);

My question is, is it possible to get both of them in one report?

For example, I have JTable contents 开发者_StackOverflowas following:

EMP_NO, EMP_NAME, EMP_SALARY

which is the main content of the table and I want something in the header from a SQL table Department

Department_no, Department_Name

Any ideas?


Found a workaround...

I am getting the contents of the table from database to java using jdbc, and then using params hashmap to pass those contents to report.

Got this idea from here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号