Jump to content

How to get total pages number from scriptlet


jiechu

Recommended Posts

I saw the threads that how to get total pages number / current page number from JasperPrint, but actually, I need to get total pages number / current page number from a scriptlet.

For example, ReportScriptlet extends JRDefaultScriptlet.

Is there any way to get JasperPrint jr from the scriptlet?

Many thanks.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 10 years later...

Hi, it is posible:

This is a example, scriptlet.

public class PagesCount extends JRDefaultScriptlet {    public Integer getPagesNumber() {                            try {                                    return (Integer) this.getVariableValue(JRVariable.PAGE_NUMBER);        } catch (JRScriptletException ex) {            Logger.getLogger(JRSPagesCount.class.getName()).log(Level.SEVERE, null, ex);        }                return null;    }    ...}[/code]

Regards

 

 

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...