Jump to content
Changes to the Jaspersoft community edition download ×

Formatting Issues


Recommended Posts

I have been having some formating issues when printing some of the fields in one of my reports. I have a total of 4 date fields, which I format using a custom class by calling:



This method will return me a formated date according to my specs, which I will spare you from trying to understand. :)


Now, this is what I have noticed in the output of my report...

1) there is usually a space between 'mm-' and 'dd-yyyy' which throws the formatting of a bit.

2) there is a field named 'rec-id' that is displayed before all the dates (there are other fields displayed between the dates as well). This field is usually 12 charaters long, but some rec-id's can be 15 characters long, when that happens all my dated are out of place, they look as they start one character more to the left when compared to the other dates.


Has anyone experienced anything similiar?



Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I Don't understand...


if you already have an own Formater-Class where is the problem and how can the date-string (I guess you return it as java.lang.String) contain spaces between some parts? Isn't it part of your Formater-Class to return a string fitting your own needs? So it can't be a Jasper-Matter, or what I don't understand!??!?!


second - if you id field is variable length.. you should make it as wide as it can max be. (so in your case 15 chars). Then it doesn't break itself.... and if it doesn't stretch it can't influence the other output.


Are your dates side by side or below?

So as I use our dates also as String objects (depending at a global setting within our ERP-System) I don't have problems with patterns etc.




Link to comment
Share on other sites

Hi CBox, sorry it wasn't clear enough. Let me try to explain it...


1) I have a method that takes care of formating the Date and returns me a formatted String with NO blank spaces in it. When I generate a report, spaces are inserted in the string. The formater method is not inserting the spaces, but rather its happening somewhere else after the value is returned to the jasper report.


2) My cells are wide enough, there is no need for stretching. I just noticed that the spaces in the date/string fields are only inserted if the value in the ID field is shorter than usual. Do you think this may be because when the report is compiled it tries to pad the string values in the field?


I have 4 dates per row, and about 10,000 rows in one of my reports. Whenever the ID field that comes before all the dates is 12 characters, the date/string field gets out of wack. (spaces are inserted in position 1 and 5 of the string.


Hope this is clearer. I appreciate any help on this matter since I need to be able to reproduce the exact layout of our current report so I can drop reportmill and only support jasper reports in my application.




Link to comment
Share on other sites

I have not experienced that in static text at all, but I can certainly try to run some more tests to see if I can replicate the issue in a simple report.


I have noticed the problem in HTML, PDF and Excel.


I was using Jasper Reports 1.2.5, with JDT 3.1.1, JRE For the moment this is running locally on a windows xp box for testing. The problem is evident when running the class both as a unit test and from within a JBoss server application.


I just updated the Jasper .jar file and the problem seemed to go away. I know this doesn't help much, but I will keep you informed if that ever comes back.


thanks for your help,


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...