I need to have a staticText to float below another element with variable height. I'm taking a sample from the book JasperReports for Java Programmers. It says that it's possible to do it. The difference with my sample is that I use a hard coded string in textFieldExpression, they use a $F{} field.
<textField isStretchWithOverflow="true" hyperlinkType="None">
<reportElement x="0" y="0" width="100" height="24"/>
<box>
<pen lineWidth="0.5" lineStyle="Solid"/>
</box>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA["jjjjjjjjjjj oooooooooo uuuuuuuuuu aaaaaaaaaa xxxxxxxxx u ttttt"]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="0" y="25" width="500" height="30"/>
<box>
<pen lineWidth="0.5" lineStyle="Solid"/>
</box>
<textElement/>
<text><![CDATA[ This staticText element has a positionType of "Float" ppp ]]></text>
</staticText>
It says that when you use positionType="Float", the y attribute is ignored, because the staticText is positioned below the textField. This appears to work, BUT... is it possible they are BS'ing me? The textField has y=0 and height=24. The staticText has y=25. Coincidence? If I change the staticText's y, it is obvious that it isn't ignored: the element is positioned wherever I tell it to. There's no floating!!! Quote from the book:
As we can see, setting the positionType attribute of to Float made JasperReports ignore the y position of the element, which was pushed down by the stretched element.
No, we don't see how it is being ignored because y=25 is where we expected it! Does positionType="Float" work for staticText at all? Thanks!