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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Assuming you are using Swing, here is an example how to do it.
Edit:
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);