I want to generate a pdf file with JasperReport
, with JasperSoft Studio 6.5.
In my jrxml
file I have two level of subreports.
I have more difficult with the layout of this report. This report contains (1° subreport) a dynamic list of file (with a description field, which in some cases is very wordy).
The 2° subreport is a list of files (composed by file name and note)
The row that contain the 1° subreport have a height dynamic in base of two criteria:
- the description field
- the number of the row conteined in the second subreport
If the 2° subreport is higher than the first, I have a problem if I have a page change. Thus, if the first subreport is higher than the second, the second does not follow the height of the first.
It's not a simple problem to describe, I know. I hope the image can help you understand.
CASE 1: Verbose description:
CASE 2: Second subreport are divided over several pages
In my jrxml file I have used this:
<subreport>
<reportElement key="" stretchType="ContainerHeight" isPrintRepeatedValues="false" mode="Opaque" x="310" y="0" width="285" height="35" uuid="1b99fb4b-1bfd-4f88-8ef7-1568c6de04aa">
<printWhenExpression><![CDATA[!$FlistSource}.isEmpty()]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listSource})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR}+ "sub_filename.jasper"]]></subreportExpression>
</subreport>
I don't find an elengant solution for this report, any ideas?