Stretching of cell in XSL export of Jasper reports -
for vertical stretching of cell in xsl export set cell parameter "stretch overflow", use special xsl property <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
, cover cells frame element. fine in main report. there problem in subreports. cells not stretching. have such code:
<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>
i have been dealing problem long time , afaik xls format issue , cannot solved completely. there number of tricks can try though, including these: http://community.jaspersoft.com/questions/844164/shrink-fit-property-when-exporting-excel
Comments
Post a Comment