How to dynamically change the height of the strip?

Is it possible to dynamically change the height of a range of parts in a jasper report? Because in my application I need to create a pdf document. I used one main document within the range of details of this main document, in which I used one subheading. The sub report will use java bean as the data source. This java bean returns a list of fields. Therefore, if we fix the size of the strip, then for a while all the values ​​do not stretch in the document. Is it possible to dynamically change the range of parts.

+6
jasper-reports
source share
2 answers

You can use JRXmlLoader.load() to create a JasperDesign object from a template file. Use a method like getPageHeader() to get the range you want, and return the return value to JRDesignBand : the returned object implements JRBand , but for JasperDesign it is always JRDesignBand . There is a setHeight() method in the setHeight() class.

Finally, use JasperCompileManager.compileReport() to create a JasperReport from the (now modified) JasperDesign .

+6
source share

 JasperDesign jasper = JRXmlLoader.load(objeto.getRealPath("/reports/reportTaxType.jrxml")); JRDesignBand banda = (JRDesignBand) jasper.getDetail(); banda.setHeight(2000); //YOU CAN SET THE SIZE THAT YOU WANT JasperReport report2 = JasperCompileManager.compileReport(jasper); JasperPrint print = JasperFillManager.fillReport(report2, parameters, ds); 
+6
source share

All Articles