我是JasperReport的新手,我想在XML文件的TextField中设置一个属性。
我已经阅读了答案here,并且我希望按照注释中的说明在TextField中设置属性。
net.sf.jasperreports.text.save.line.breaks = true
我尝试过:
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-2" positionType="Float" x="409" y="170" width="300" height="14" stretchType="RelativeToTallestObject" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Courier New" size="8"/>
</textElement>
<property name="net.sf.jasperreports.text.save.line.breaks" value="true"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{customerReference}]]>
</textFieldExpression>
</textField>
但是编译器说:
发现无效的内容以元素'property'开头
正确的方法是什么?谢谢。
property
元素需要放入reportElement
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-2" positionType="Float" x="409" y="170" width="300" height="14" stretchType="RelativeToTallestObject" isPrintWhenDetailOverflows="true">
<property name="net.sf.jasperreports.text.save.line.breaks" value="true"/>
</reportElement>
...