Category: | Feature request |
Priority: | Normal |
Status: | Feedback Requested |
Project: | Severity: | Minor |
Resolution: | Open |
|
Component: | Reproducibility: | Always |
Assigned to: |
Use-case:
Page $V{PAGE_NUMBER} of $V{PAGE_COUNT}
Two text fields are needed. The one containing $V{PAGE_NUMBER} has its "Evaluation Time" set to "Now" while the other one containing $V{PAGE_COUNT} is set to "Report" as follows:
+------------------------+---------------+
|Page $V{PAGE_NUMBER} of | $V{PAGE_COUNT}|
+------------------------+---------------+
If the text field containing $V{PAGE_NUMBER} cannot be stretched horizontally, the report designer has to provide ample room between the first text field and the second one. Otherwise, the first text field can step on the second text field.
When the first text field stretches to the right, the second text field needs to be able to float horizontally too with regard to its position type.
Since such a page information can be aligned on the right, the text field should also provide an option to stretch horizontally to the left in addition to stretching horizontally to the right.
4 Comments:
Any chance we can get horizontal stretch? I understand that sometimes it messes with format, but in several cases it would be wonderful to have.
For anyone who gets here as I did. You can get a pretty decent results for this special case (Page n of nn) with three "moving" pairs of elements and printWhenExpression conditions. Example:
<staticText>
<reportElement x="5" y="0" width="50" height="25" uuid="404d1dbe-2f76-48fd-9087-599845281ade"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Page]]></text>
</staticText>
<textField isStretchWithOverflow="true" evaluationTime="Page">
<reportElement x="40" y="0" width="20" height="25" uuid="eb715e0c-2891-4d2b-848e-d06818656be0"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="50" y="0" width="20" height="25" uuid="241e7af4-cfdf-44eb-9eff-cb0ba5bb8c9d">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}<10]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[of]]></text>
</staticText>
<textField evaluationTime="Report">
<reportElement positionType="Float" x="65" y="0" width="20" height="25" uuid="eb715e0c-2891-4d2b-848e-d06818656be1">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}<10]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="55" y="0" width="20" height="25" uuid="241e7af4-cfdf-44eb-9eff-cb0ba5bb8c9d">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}>=10 && $V{PAGE_NUMBER}<100]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[of]]></text>
</staticText>
<textField evaluationTime="Report">
<reportElement x="70" y="0" width="20" height="25" uuid="eb715e0c-2891-4d2b-848e-d06818656be1">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}>=10 && $V{PAGE_NUMBER}<100]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="60" y="0" width="20" height="25" uuid="241e7af4-cfdf-44eb-9eff-cb0ba5bb8c9d">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}>=100]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[of]]></text>
</staticText>
<textField evaluationTime="Report">
<reportElement x="75" y="0" width="20" height="25" uuid="eb715e0c-2891-4d2b-848e-d06818656be1">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}>=100]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
Hi,
Have you tried to use a single text field element with evaluationTime="Auto"?
Thank you,
Teodor