Jump to content
  • Set band height using expressions

    Assigned User teodord
    CategoryFeature request
    ResolutionNo Change Required

    We want to generate a report that can be printed on pre-printed stationary, the layout of which can be variable depending on the customer printing the report. The height of the pre-printed letterhead is stored in the database and can be retrieved in the resultset.


    It doesn't appear the height of a band can be altered after the design stage (except presumably indirectly when a text field stretches vertically). So even having access to the JasperPrint object the height of the page header band can't be altered.


    What would be helpful if the height of the band (plus perhaps other properties and on other Jasper objects) could be tied to an expression as per the 'print when' expression currently does



    User Feedback

    Recommended Comments



    You could modify the band height if you would keep JRXML source files and load them at runtime into a JasperDesign object, modify what you want using the JR API and then compile it and run it.


    Basically, your use case scenario talks about report templates that change at runtime. Dynamic report templates can be created or at least be modified using the JR API.


    Check the /demo/samples/noxmldesign sample provided with the JR project.


    Other solutions include using a stretchable text field in the header, with white forecolor on white background and maybe fixed size font. You would put as many newline characters in this text field so that you make it stretch the length you need to.


    I hope this helps.



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