jiechu Posted August 13, 2010 Share Posted August 13, 2010 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 More sharing options...
Teodor Danciu Posted August 19, 2010 Share Posted August 19, 2010 Hi, While the scriptlet events are fired, the JasperPrint object is not yet final, so you cannot get its total number of pages yet.You have to explain better what you need to do, because there might be other ways to achieve that. Thanks,Teodor Link to comment Share on other sites More sharing options...
ecanaveras Posted October 30, 2020 Share Posted October 30, 2020 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 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