callkalpa Posted April 12, 2010 Share Posted April 12, 2010 Is it possible to know whether a JasperPrint is an empty document or not before viewing with a JRViewer?What I want to do is to check whether the JasperPrint has some data and only if it has some date, display JRViewer and the report.So please help me. Thanks in advance. Link to comment Share on other sites More sharing options...
callkalpa Posted April 12, 2010 Author Share Posted April 12, 2010 I found a way, although it may not be the best, it works. :-)Code:// jp is the JasperReportif(!(jp.getPages().toString().equals("[]"))){ JRViewer jrv = new JRViewer(getJP()); Container c = getContentPane(); c.add(jrv); setDefaultCloseOperation(DISPOSE_ON_CLOSE); Main.getMainGUI().getMainPane().add(this); setClosable(true); setIconifiable(true); setTitle(getReportTitle()); setBounds(this.getParent().getBounds()); setVisible(true);} Link to comment Share on other sites More sharing options...
libero Posted April 14, 2010 Share Posted April 14, 2010 Hi,why not: if (jasperPrint.getPages().size() != 0) libero Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now