使用PDF导出器忽略isStretchWithOverflow属性值渲染文本 [英] The text is rendering clipped ignoring isStretchWithOverflow property value using PDF exporter
问题描述
是否可以在groupHeader中包装文本?我在详细信息部分工作,
但组内的文本似乎不想包装。我已经尝试了我能想到或从谷歌找到的包装的每个组合。
Is it possible to wrap text in a groupHeader? I have it working in the detail section, but the text within the group does not seem to want to wrap. I have tried every combination for wrapping I could think of or find from google.
<style name="reportProject" isDefault="false" fontName="Times" fontSize="10" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
<group name="PROJHEADER" minHeightToStartNewPage="60">
<groupExpression><![CDATA[$F{projectHeader}]]>
</groupExpression>
<groupHeader>
<band height="40" splitType="Stretch">
<printWhenExpression><![CDATA[Boolean.valueOf($F{projectHeader}.length() > 0)]]>
</printWhenExpression>
<textField isStretchWithOverflow="true" isBlankWhenNull="true"
evaluationTime="Group" evaluationGroup="PROJHEADER" bookmarkLevel="1">
<reportElement positionType="Float" style="reportProject" mode="Opaque" x="0" y="5"
width="515" height="15" backcolor="#C0C0C0"
stretchType="RelativeToBandHeight"/>
<box leftPadding="10">
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle" />
<textFieldExpression class="java.lang.String"><![CDATA[$F{projectHeader}]]>
</textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
推荐答案
设置 isStretchWithOverflow 属性 true 值可以帮助我。
Setting the isStretchWithOverflow property with true value helps me.
示例:
<group name="citygr">
<groupExpression><![CDATA[$F{CITY}]]></groupExpression>
<groupHeader>
<band height="20">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CITY} + " text1 txt2 longtext3 verylonglongtxt4 long1234567890verylongtext5 txt6 text6 longtext7"]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
结果将是:
< img src =https://i.stack.imgur.com/KMNZU.pngalt =pdf报告>
我正在使用 iReport 4.1.3 。
I'm using the iReport 4.1.3.
您也可以尝试设置 net.sf.jasperreports.export.pdf .force.linebreak.policy 属性。只需在jrxml文件中添加此属性即可。您可以阅读这里。
You can also try to set net.sf.jasperreports.export.pdf.force.linebreak.policy property. Just add this this property in your jrxml file. You can read about this property here.
样本:
<jasperReport ...>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
这篇关于使用PDF导出器忽略isStretchWithOverflow属性值渲染文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!