I've read there's no way to handle mixed orientations natively using iReport, however reading the documentation I wonder if by using JRDefaultScriptlet's beforePageInit() it could be accomplished somehow. In my case there's a portrait front page, as many landscape pages as there's data to populate them, and a last frontal page.
On the other hand does anybody know:
- If this is a feature to be supported in the near future
- If there's an alternative that does as requested and generates a jasper-compliant xml file
Thanks in advance.
There is no support to mixed landscape and portrait subreport, in the future they will add an object call JasperBook or something like that where you can add different subreports of different orientations without problems, but for the moment you have simulate that by doing different reports and join them just before showing them.
I.E.
//Create the reports separately
//Add the JasperPrint objects to an ArrayList
//And say to the exporter to join the list of reports.
I'm doing that in my reports and it works. Good luck!
So I decided to play around with iReport and see what options there where for this. Turns out it is sort of possible to pull off, with some effort and imagination. This is assuming your first page is in the Title Section, and your Last Page is in the summary section.
Create your report in landscape mode.
Under Report Properties in iReport set
Title on New Page
andSummary on New Page
to true.Assuming you are using a standard 8.5" X 11" Letter sized page with all the margins set to 20, set the height of the Title and Summary sections to 572.
Add your static text fields into the appropriate section.
Now for each static text field you need to set the
Rotate
property toLeft
(well it could actually beRight
, the point is they all need to be the same.Of course add the all the other fields you want into the appropriate bands for page header, data, etc.
Export your report.
Note: if you have any images that need to go into the Title or Summary Section your will need to rotate them appropriately outside of iReport and save it. Then set the rotated image as the image in the report. Unfortunately the image tag does not seem to have a rotate property, as that would make life to easy.
Also if you do not set the properties listed in step 2 you will not be able to set the height of the Title and Summary bands to the appropriate width. If you are using a different size paper and/or margins the easy way to figure out the max size (which is what you will need) is to set the height of the band to a very large number. It will then popup and tell you it is to large, and what the max size actually is.