Have a look at printWhen expressions which can be used to conditionally show or hide bands (report sections) or even elements (like text fields, charts etc). In there you can add any expression, it has to return true or false. If true is returned, the section is shown, otherwise not. In combination with multiple detail bands this should allow you to implement the flexible layout you wish. In terms of calling external Java Code you need to make sure that the required classes are available for JasperReports, ie that they are in the iReport and JasperReports embedding application's classpath.