How can I format a cell with a String as excel Text?


I have a report with a field filled with a java.lang.String value. This report generates an excel file and I need to format it as text.

Currently using iReport 3.7.6 to generate de jrxml and jasper files and jasper 4.6.0 with a web application.


I tried setting pattern format for rhe cell in the jasper report to @, but I guess it is not valid.

On other 'numeric' fields with a given pattern I was able to use JRXlsAbstractExporterParameter.FORMAT_PATTERNS_MAP to give it a text format in excel with a map mapping the format '#,##0' to '@', but I have not been able to apply this way with the String field

How can I do it?

Could I do it with a newer jasper version ?

tsukebumi's picture
Joined: Jan 29 2014 - 3:38pm
Last seen: 3 years 1 month ago

1 Answer:


You can't format text string with a "pattern". If the text field contains numeric, date, or currency, convert it to their respective data type and then do a format.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 year 7 months ago