Jump to content

change subreport design from java side


islam69

Recommended Posts

 how are you

i am using Servlet  and  i use this code to chage aliment for my report 

 

                JasperDesign design = JRXmlLoader.load(input);

                JasperReport report = JasperCompileManager.compileReport(design);                

                JRField[] jrFieldList =   design.getFields();

                JRField field = jrFieldList[1];

                field.getPropertiesMap().setProperty("align","right");

but i have subreport in this report how can i change the align for it wile the main report together because the align is change from main report only

 

Code:
  JasperDesign design = JRXmlLoader.load(input);                JasperReport report = JasperCompileManager.compileReport(design);                                JRField[] jrFieldList =   design.getFields();                JRField field = jrFieldList[1];
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Use scriptlet in subreport. Then you have acces to JasperReport object representing subreport.

 public void beforeReportInit() throws JRScriptletException
    {
        try
        {
            JasperReport report = (JasperReport) this.getParameterValue("JASPER_REPORT");           
        }
        catch (Exception e)
        {

        }
    }

Link to comment
Share on other sites

  • 11 months later...

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