如何在Jasper Reports中拉伸相对于数据宽度的文本字段
我有一个文本字段后跟一个静态文本字段,我正在尝试用它做两件事:
I have a text field followed by a static text field and I am trying to do 2 things with it:
- 获取文本字段在文本长于字段宽度时水平拉伸(而不是换行)
- 当静态文本字段向左伸展时,向右推动静态文本字段
两个字段都包含在一个框架内。
Both of the fields are contained within a frame.
我将两个字段都设置为positionType = float和text字段设置为stretchWithOverflow = true,它允许文本垂直包装但不能水平拉伸。
I have both fields set to positionType=float and the text field set to stretchWithOverflow=true, which enable text to wrap vertically but not stretch horizontally.
是否可以实现上面的1和2?如果是这样?
Is it possible to achieve 1 and 2 above? If so How?
您可以拥有1个值为的文本字段,而不是2个文本字段(动态和静态) $ F {Field} +statix text
。这可能会解决您的问题。此外,您可以根据您的要求设置宽度和带溢出拉伸属性。
Instead of having 2 text fields (dynamic and static), you can have 1 text field with value as $F{Field} + "statix text"
. This will probably fix your issue. Also, you can set the "width" and "stretch with overflow" properties, as per your requirements.