admin管理员组文章数量:1316974
Using JasperReports Version 6.20.
I have two textfields that are elements in a list that I want to iterate on. One textfield should be placed under the other. But when I try to do it, they overlap each other in the report. I can't use the simple y
value, because I actually want a sublist in between that grows dynamically. For simplicity sake I only show the two textfields in the xml code.
Here is the example:
<jr:list xmlns:jr="; xsi:schemaLocation=" .xsd" printOrder="Vertical">
<datasetRun subDataset="TableGroup" uuid="28256056-95ed-4ce9-80ee-47a10ede48f1">
<datasetParameter name="myObject">
<datasetParameterExpression><![CDATA[$P{myObject}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{myObject}.getMyList())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="250" width="500">
<frame>
<reportElement x="0" y="0" width="500" height="250" uuid="566f22c8-abbe-4709-962c-c393366555bf"/>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" stretchType="ContainerHeight" x="0" y="0" width="200" height="20" uuid="e8873bea-aa28-4439-b4cf-3fd40b487ae6"/>
<textFieldExpression><![CDATA[$F{elementOne}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" stretchType="ContainerHeight" x="0" y="0" width="310" height="20" uuid="fb38a2e3-f141-472b-9fe0-fd1b998eb611"/>
<textFieldExpression><![CDATA[$F{elementTwo}]]></textFieldExpression>
</textField>
</frame>
</jr:listContents>
</jr:list>
The printOrder
is "Vertical". I've tried multiple attributes for example positionType="Float"
such that it is dynamically loaded but it just doesn't work. I tried to put it in a subreport and in bands but then the sublist is the problem because the subreport iterates for each element once in the sublist and not once for all elements (Hence there are too many elements displayed).
How can I place the elements in the list vertically on top of each other dynamically?
Using JasperReports Version 6.20.
I have two textfields that are elements in a list that I want to iterate on. One textfield should be placed under the other. But when I try to do it, they overlap each other in the report. I can't use the simple y
value, because I actually want a sublist in between that grows dynamically. For simplicity sake I only show the two textfields in the xml code.
Here is the example:
<jr:list xmlns:jr="http://jasperreports.sourcefe/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourcefe/jasperreports/components http://jasperreports.sourcefe/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="TableGroup" uuid="28256056-95ed-4ce9-80ee-47a10ede48f1">
<datasetParameter name="myObject">
<datasetParameterExpression><![CDATA[$P{myObject}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{myObject}.getMyList())]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="250" width="500">
<frame>
<reportElement x="0" y="0" width="500" height="250" uuid="566f22c8-abbe-4709-962c-c393366555bf"/>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" stretchType="ContainerHeight" x="0" y="0" width="200" height="20" uuid="e8873bea-aa28-4439-b4cf-3fd40b487ae6"/>
<textFieldExpression><![CDATA[$F{elementOne}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" stretchType="ContainerHeight" x="0" y="0" width="310" height="20" uuid="fb38a2e3-f141-472b-9fe0-fd1b998eb611"/>
<textFieldExpression><![CDATA[$F{elementTwo}]]></textFieldExpression>
</textField>
</frame>
</jr:listContents>
</jr:list>
The printOrder
is "Vertical". I've tried multiple attributes for example positionType="Float"
such that it is dynamically loaded but it just doesn't work. I tried to put it in a subreport and in bands but then the sublist is the problem because the subreport iterates for each element once in the sublist and not once for all elements (Hence there are too many elements displayed).
How can I place the elements in the list vertically on top of each other dynamically?
Share Improve this question edited Jan 30 at 8:29 OhJohnny asked Jan 29 at 20:46 OhJohnnyOhJohnny 3513 silver badges13 bronze badges1 Answer
Reset to default 0The key to align items in a list vertically to use bands. Since the bands are not placeable in a jr:list I needed to create a subreport. Putting the block in listContents in a subReport resolves the problem.
本文标签:
版权声明:本文标题:jasper reports - jasperreports: vertical arrangement in jr:list doesn't work and results in overlapping elements - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741997430a2410326.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论