JasperReports では、 current-page / total-pagesのスタイルでページ番号をレンダリングするのが好きです。公式のデモを調べると、3つを使用して次の解決策を見つけることができます(ページ数のTextFields
組み込み変数がないため)
<!-- 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>
ただし、これは完全なページング情報がページに対して中央に配置されている場合 (中央にスラッシュがある場合) にのみ正常に機能します。私が達成したいのは、合計ページが右の境界線から一定の距離になるように、グループ全体を右揃えにすることです。
これを達成する方法は?