1

我们可以使用 iReport 获得一个类似于 .Net 的 Crystal 报表的报表页面吗?那就是我需要在框架内获取报告。

4

1 回答 1

4

假设您使用的是 Swing,这里有一个示例。

编辑:

尝试获取 JasperViewer 容器并将其添加到主 JFrame 或 JPanel。

有点骇人听闻的工作,但它应该可以解决问题。

JasperDesign jd = JRXMLoader.load("FilePath"); 
JasperReport jr = JasperCompileManager.compileReport(jd);
JasperPrint jp = JasperFillManager.fillReport((jr),null,con);
// Create an instance of the JasperViewer instead of using the static call
JasperViewer viewer=new JasperViewer(jp,false);
// Get the viewers container and add that to the main frame or panel
Container container = viewer.getContentPane();
myMainJFrame.add(container);
于 2010-03-16T12:30:29.187 回答