JAVA报告工具iReport [英] JAVA Reporting Tool iReport

查看:155
本文介绍了JAVA报告工具iReport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Can we get a reporting page which is like .Net's Crystal report using iReport? That is I need to get the report inside the frame.

推荐答案

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

Assuming you are using Swing, here is an example how to do it.

编辑:

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

Try getting the JasperViewer container and add that to the main JFrame or JPanel.

有点黑客工作,但它应该可以解决这个问题。

Bit of a hack job but it should do the trick.

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);

这篇关于JAVA报告工具iReport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆