Information about JasperReports Center Aligned Room Numbers

In JasperReports, I like to display page numbers in the style of the current page / summary pages. By studying the official demos, you can find the following solution using three TextFields(because there is no built-in variable for the number of pages)

<!-- Right aligned current page -->
<textField>
    <reportElement x="100" width="40" .../>
    <textElement textAlignment="Right" ... />
    <textFieldExpression class="java.lang.String">
        <![CDATA[String.valueOf($V{PAGE_NUMBER})]]>
    </textFieldExpression>
</textField>

<!-- Centered aligned slash -->
<staticText>
    <reportElement x="140" width="5" .../>
    <textElement textAlignment="Center" ... />
    <text>
        <![CDATA[/]]>
    </text>
</staticText>

<!-- Left aligned total number pages (evaluationTime="Reports") -->
<textField evaluationTime="Report">
    <reportElement x="145" width="40"/>
    <textElement textAlignment="Left" ... />
    <textFieldExpression class="java.lang.String">
        <![CDATA[String.valueOf($V{PAGE_NUMBER})]]>
    </textFieldExpression>
</textField>

However, this only works when full paging information is centered on the page (with a slash in the middle). What I like is the right alignment of the entire group so that the full pages have a constant distance to the right border.

How to do it?

+3
source share
2 answers

, . , : " ". . , $V{PAGE_NUMBER} ... , .

" " Report Time.

, $V{PAGE_NUMBER} ... Now Page ( ).

Now Page.

, .

. , .

. , , , . , , , . , " 3 xxx" xxx . , ; . .

, , - . , , , . . .

. , , , , Auto. , .

+3

http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=68429.

, , evalutionTime="Auto" Page {X} of {Y}.

(- http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=68429)

CURRENT_PAGE_NUMBER

Variable class: java.lang.Integer
Calculation: Nothing
Reset type: Page
Variable Expression: $V{PAGE_NUMBER}

. (, , Reset type: None, , Page {X} of {Y} , , , .)

, , Page {X} of {Y} - , :

msg("Page {0} of {1}", $V{CURRENT_PAGE_NUMBER}, $V{PAGE_NUMBER})  

evaluationTime="Auto"

, , .

+2

All Articles