开发者

Jasper reports - iReport - page number variable doesn't work

I have to prepare a letter in which I require a 40 mm page header for first page and 20mm page header for all o开发者_如何学编程ther pages except the first page. So I've created 2 page headers.

I want to hide/show the page headers based on the page number. But when I write the following print when expression, it doesn't work.

$V{PAGE_NUMBER}.equals("1")


You need to check what the type of $V{PAGE_NUMBER} is... (I think it is java.lang.Integer)

The method you choose return a boolean an a PrintWhenExpression should return a java.lang.Boolean, so you need to instantiate one.

Try :

new Boolean($V{PAGE_NUMBER}.equals("1"))

It should work... To improve your test, I think that it is better to make a int comparison (a Java specialist should confirm that)

new Boolean($V{PAGE_NUMBER}.intValue() == 1)

The other manipulation you might have to do is specifying the whole object name (I don't know how JasperReport deals with import)

new java.lang.Boolean($V{PAGE_NUMBER}.intValue() == 1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜