对于XSL导出中单元格的垂直拉伸,我设置为此单元格参数“Stretch with overflow”,使用特殊的xsl属性<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
并按框架元素覆盖单元格。主报告中的一切都很好。但是子报告中存在问题。细胞没有伸展。我有这样的代码:
<detail>
<band height="16" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<frame>
<reportElement positionType="Float" x="0" y="0" width="400" height="15" uuid="">
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="0" y="0" width="80" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{operator}!=null?$F{operator}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="80" y="0" width="80" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{casino}!=null?$F{casino}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="160" y="0" width="75" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{cabinet}!=null?$F{cabinet}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="235" y="0" width="80" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<box topPadding="1" bottomPadding="2"/>
<textFieldExpression><![CDATA[$F{serial}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="315" y="0" width="60" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{soft}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="subCell" stretchType="RelativeToTallestObject" x="375" y="0" width="25" height="15" uuid="">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{isOnline}==true?"Yes":"No"]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
答案 0 :(得分:1)
我一直在处理这个问题很长一段时间和AFAIK这是一个XLS格式问题,无法完全解决。您可以尝试一些技巧,包括:http://community.jaspersoft.com/questions/844164/shrink-fit-property-when-exporting-excel