Jump to content

detect "The document has no pages." in java code


callkalpa

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...