Reputation: 2121
I have a report using the following lines to display "page X of Y" in the footer:
<textField isStretchWithOverflow="true">
<reportElement x="432" y="21" width="95" height="10" forecolor="#000000"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[
$R{Report.Footer.Label.Page} + " " + $V{PAGE_NUMBER}
]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Report">
<reportElement x="527" y="21" width="20" height="10" forecolor="#000000"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
In our test environment everything works fine. The page numbers are displayed correctly.
In the customers environment things are very strange. The second textField is not displayed. But when I change the evaluation type of the second field to "Now" it is displayed.
Do you have any idea what could cause the difference between the behaviour in our and the customers environment? Do you have any hints or do you know any details about rendering fields with evaluation type Now and Report which could help me to solve the problem?
I am using Jasper Reports 4.1.2.
Edit: Even if the variable is removed and I use
<textFieldExpression><![CDATA["T"]]></textFieldExpression>
the behaviour remains the same. With evaluationTime="Report" the second text field is not displayed. With "Now" it is.
Upvotes: 6
Views: 6883
Reputation: 2121
I finally found the solution:
The problem is that in the customers environment the fields have to stretch because the customers system seems to use another font than our system does. In our environment they do not and in the JasperReports Ultimate Guide there is the following section about stretching behaviour:
Text fields with delayed evaluation do not stretch to acquire all the expression’s content. This is because the text element height is calculated when the report section is generated, and even if the engine comes back later with the text content of the text field, the element height will not adapt, because this would ruin the already created layout.
Thus the fields disappear in the customers environment with evaluation type != "Now" because they do not stretch in this case. Increasing the height of the fields helped but I think on the long term we will have to change the font settings to have the same conditions in our test environment.
Upvotes: 7