Hi community.
I'm not new to jasperreport but I'm getting mad to find a solution to the following problem:
- the report is a tipical invoice with head, title, detail, footer, summary, etc.
- the report/invioce can have N pages
- if and only if the total number of the pages is odd I need to add at the end a completely blank page (the format is A4)
I tried to search using "last blank page" or "blank page" or "blank page at the end" and so on but nothing related to this specific problem.
Have anyone ever had and solved (of course) a such problem?
Do you have any suggestion?
Thanks in advance.
5 Answers:
Hi hozawa.
Thank you very much for your answer. Your suggestion worked perfectly. I put in the report a break element in the summary with the condition:
$V{PAGE_NUMBER}.intValue()%2!=0
In this way ONLY if the last page is odd I get an "almost" blank page.
Almost because with your suggestion I solved the 99% of the problem.
The last 1% of the issue is that in the report I use backgroud band to render vertical lines for report column.
So I'd need a way to say the report to NOT print vertical lines in the last page of the report and only if the last page is odd.
The condition "page odd" is easy. The condition "last page of the report" seems to be impossible to solve (I google it a lot also on the forum).
I could solve it if in jasper report there was the possibility to know at the beginning of the report the total number of pages (let's say TOTAL_PAGE_NUMBER) and create a "print when expression" like the following to apply to the vertical lines:
( $V{PAGE_NUMBER}<$V{TOTAL_PAGE_NUMBER} ? newBoolean(true) : newBoolean(false) )
Any idea or workaround to solve this last problem? Any help is appreciated.
Thank you very much.
Hi riodavid.
Thank you for you suggestion. It wouldn't work because I'd need to use the variable $V{PAGE_NUMBER} in the "Print when expression".
When you use the variable $V{PAGE_NUMBER} to check its value in the "Print when expression", there is no way to specify [Evaluation Time] to [Report] or [Evaluation Time] to [Now] .
The value of the variable $V{PAGE_NUMBER} in the "Print when expression" is always the current page number and nothingelse.
Anyway thank you for you reply.
You are right. This is hard to achieve. Someone asked this question in 2007 and still no valid answers.
https://community.jaspersoft.com/questions/515587/how-know-total-pages-r...