views:

20

answers:

2

Is it possible to specify word breaking in a JasperReport? I have the word "perceelnummer" which has to be split in "perceel" and "nummer" if the text field overflows. I cannot find a character to put this in my resources file.

A: 

You could try something along the lines as below in your field expression.

If your string is longer than some max value print a substring of the value else print the full value.

    ($F{name}.length() > $V{SOME_MAX_VALUE}) 
? $F{name}.substring(0,$V{SOME_MAX_VALUE}) : $F{name}
Gordon
A: 

You could try adding a zero-width space \u200B to the word. That might cause JasperReports to split only when the text field overflows (I haven't tried it myself, but it works in other software!). http://en.wikipedia.org/wiki/Zero-width_space

Try

"perceelnummer".equals($F{name}) ? "perceel\u200Bnummer" : $F{name}
gutch