对于XSL导出中单元格的垂直拉伸,我设置了这个单元格参数"Stretch with overflow",使用特殊的xsl属性<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>和cover cells by frame元素。在主报告中一切都很好。但子报表中存在问题。单元格没有拉伸。我有这样一个代码:
<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>
发布于 2015-07-18 21:32:02
我已经处理这个问题很长一段时间了,AFAIK,这是一个XLS格式的问题,不能完全解决。不过,您可以尝试一些技巧,包括以下这些:http://community.jaspersoft.com/questions/844164/shrink-fit-property-when-exporting-excel
https://stackoverflow.com/questions/31404289
复制相似问题