Jump to content
Changes to the Jaspersoft community edition download ×

Problem using generic pattern for TextField


Recommended Posts

According to "The Jasper Reports Ultimate Guide", when specifying the value of the pattern attribute for Date values to be displayed in TextField elements, one can use either a specific pattern that could otherwise be supplied to java.text.SimpleDateFormat OR one can use two "style" values separated by a comma such as "Short", "Long", "Medium" or "Default".


I found an example of this usage in the sample code that came with JasperReports as follows:



<textField pattern="medium,hide">


But when I try to fill a report based on this JRXML, I get the following message as part of an IllegalArgumentException:

Illegal pattern character 'e'"


Is there some other setting or parameter I need to specify in order to use these generic styles instead of a specific pattern for dates? My software runs in several different locales and I would enjoy the convenience these generic styles would supply rather than having to pre-format my date values.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

AFAIK JasperReport tries to analyse the pattern and checks if it contains some of the constants like hide or short. If the detection fails, the pattern is passed to SimpleDateFormat directly.


The error message is generated by SimpleDateFormat, if the pattern contains characters not known by the parser. So the detection of the constants must have failed.


I don't not know when the "style"-feature was introduced, but I could imagine, that the feature isn't avaible in older releases. Another possibility would be just a typing mistake like "nedium,hide".

Post edited by: Alexander Merz, at: 2006/09/02 08:54

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...