开发者

Dynamically change the class attribute of jasper's textFieldExpression

开发者 https://www.devze.com 2023-03-07 03:58 出处:网络
I have to display a textField a jasper report. The report is generated to an Excel file. The problem is with a particular column which sometimes has a string and sometimes has an integer (开发者_开发问

I have to display a textField a jasper report. The report is generated to an Excel file. The problem is with a particular column which sometimes has a string and sometimes has an integer (开发者_开发问答also as string). When it has an integer as string, Excel complains that there is a number stored as text in that particular cell. I would like to display the number as a number, not as a string.

How can I dynamically change the class attribute of the textFieldExpression to be java.lang.Integer when the string is a valid number? Or is another other way to insert a condition?


Use two fields and a PrintWhenExpression that will determine the appropriate field to display.

0

精彩评论

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