【问题标题】:how to display page x of y in jasper report 5.5.1 in "single textfield" its giving alignment issue?如何在“单个文本字段”中显示 jasper 报告 5.5.1 中的第 x 页其给出对齐问题?
【发布时间】:2015-09-30 15:27:12
【问题描述】:

我有一种情况,我需要这种格式的页脚页码:

--------------------------------------------------------------------------------
page 1 of 4212                                              printed date:

页面编号应与左边距对齐。我用了这个表达方式

"Page "+$V{PAGE_NUMBER}+ " of "+ $V{PAGE_NUMBER}

但它总是给出输出

"Page 1 of 1"

如何在左对齐的单个文本字段中实现它??? 请帮我解决这个问题。

【问题讨论】:

标签: jasper-reports


【解决方案1】:

见:http://community.jaspersoft.com/questions/893771/printing-page-x-y-single-textfield-logic-jasper-ultimate-guide-section-1922

用这个定义创建一个变量(注意resetType)

<variable name="currentPageNumber" class="java.lang.Integer" resetType="Page">
<variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
</variable>

页码字段(注意评价时间):

<textField evaluationTime="Auto">
<reportElement uuid="847e339f-a1a6-492d-868b-b233f71785b4" x="166" y="22" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{currentPageNumber} + " of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多