Compare current page number with last page number

前端 未结 3 905
余生分开走
余生分开走 2020-11-27 06:38

How do you check to see if the current printed page is actually the last printed page?

I have tried the following:

$V{currentPage}.intValue() == $V{t         


        
3条回答
  •  悲&欢浪女
    2020-11-27 07:13

    unfortunately your approach didn't worked for me i dont know why.. there are some stuff about your code that are error-prone like this

    
    

    i think in fact that the Summary Band is called only once but you have a bad programming practice in this because if there is not key associate with the KEY in the MAP it will return null and the you call the method equals on it you would receive NULLPOINTEREXCEPTION but i think not in this case.

    you should reverse like this

    
    

    the workaround i used on this question is the following.

    1). create a parameter in jasperreports

    parameter name="totalRecordsOnReport" class="java.lang.Integer"
    

    2). pass the totals records of your detail as parameter.

    HashMapparameters=....
    parameters.put("totalRecordsOnReport",yourDetailRowCount);
    

    i need to print some stuff only in the last page below the detail and i use this code.

    component print when expression

    $V{REPORT_COUNT}.equals($P{totalRecordsOnReport})
    

    and prints in the last page.

提交回复
热议问题