Home Ask Login Register

Developers Planet

Your answer is one click away!

Supriya Rapelli February 2016

Number Formatting in iReport

Can any body help me for giving pattern for a number?

Here is my problem.

I just wanted to display a number as "30.00",

Eventhough I had set the pattern as 2 decimal points it is not displayting the result as"30.00" instead it is showing the result as "30".

And one note is that for that field pattern it is shoeing an extra button as "ResetDefault". Is there is any problem with that button for this.

Can any one please solve this problem.


Neil February 2016

The field should have a format property indicating how it should be shown. You should set that format to Custom and put #.00 as the format in order to force that field's value to be printed with two decimal places.

The extra button shouldn't be creating conflicts, but in order to be sure, you should check the action performed when it is clicked. If it doesn't mention that field, it likely won't have any impact on it.

Petter Friberg February 2016

iReport has a bad habit of not changing the pattern on the jrxml when you just open and press OK (your format is default). Change something and then change it back, press OK and you are ready to GO.

iReport set pattern

If you are tired of iReport, you can also set pattern directly in jrxml:


<textField pattern="###0.00;-###0.00">
    <reportElement x="100" y="0" width="100" height="20" uuid="1fccff95-408c-4364-b003-c691fefdde62"/>
    <textElement textAlignment="Right" verticalAlignment="Middle"/>

Post Status

Asked in February 2016
Viewed 3,093 times
Voted 10
Answered 2 times


Leave an answer

Quote of the day: live life