Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to create Ad Hoc Template with page limits


    Friendly User
    • Features: Ad Hoc Product: JasperReports® Server

    Scenario:

    You want to have some ad hoc reports to have a strict page limit, for example no more than 100 pages total. Other ad hoc reports don't need to be limited like this or should have different limit than set for the server globally. How to achieve this?

    Solution:

    For this we can use the Max Page Governor configuration property:

    http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.governor.max.pages

    You can enable the governor globally on the server in {JRS WAR}/WEB-INF/classes/jasperreports.properties by appending the properties:

    net.sf.jasperreports.governor.max.pages.enabled=true

    net.sf.jasperreports.governor.max.pages={arbitrary number}

    This will enable the limit for all reports on the server. Now you can create an ad hoc template with the following properties added in the template JRXML:

    <property name="net.sf.jasperreports.governor.max.pages" value="{different number than in the config}"/>

    And deploy the JRXML to ad hoc templates folder to create a new template. The ad hoc reports will need to be re-saved using this template for it to take effect. This will set a new hard limit for the number you've set for these reports.

    You can also not turn on the global setting and only turn on the limit for the reports using the template by adding property:

    <property name="net.sf.jasperreports.governor.max.pages.enabled" value="true"/>

    <property name="net.sf.jasperreports.governor.max.pages" value="{arbitrary number}"/>

    Whenever you're doing the changes to the ad hoc template, remember to re-generate the reports as these changes are not propagated into existing reports that are using this template.


    User Feedback

    Recommended Comments

    There are no comments to display.



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