jasper text field getting truncated

梦想的初衷 提交于 2019-11-30 13:09:46

I had same issue and I tried all possible configurations - didn't work. Finally as a workaround I appended a new line character to the field and it worked. Something like this: $F{description} + "\n"

Had the same issues with text being truncated and nothing seemed to work. luckily I found out that my root xml element had the following attribute:

printOrder="Horizontal"

Removing it solved my issues.

In my case, I had really long text in a single text field. Adding a line break would solve the issue for some cells, but not for the really long ones that spanned pages. To finally solve it, I had to set the text field to stretch to RELATIVE_TO_BAND_HEIGHT. Previously, it was set to RELATIVE_TO_TALLEST_OBJECT. My guess is that, RELATIVE_TO_TALLEST_OBJECT was being calculated incorrectly (lower than needed).

This did the trick:

textField.setStretchType( StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT );

Well, i'm not sure if you're struggeling with the exact same problem i was. But my solution was setting the property "net.sf.jasperreports.print.keep.full.text" of the field to "true".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!