JasperReports export to excel auto size columns

后端 未结 1 395
-上瘾入骨i
-上瘾入骨i 2021-01-03 03:02

I have a problems with JRXlsExporter. Autofit properties not work correctly. Here is my jrxml:




        
相关标签:
1条回答
  • 2021-01-03 03:27

    The following properties do not work on Report Level:

    <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
    <property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
    

    You have to put them on Report Elements (i.e.):

            <staticText>
                <reportElement x="0" y="100" width="100" height="20">
                    <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
                    <property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
                </reportElement>
                <textElement/>
                <text><![CDATA[Your Static Text]]></text>
            </staticText>
    

    Also I'd recommend you to try using net.sf.jasperreports.export.xls.column.width property, which is more useful. Reference: http://jasperreports.sourceforge.net/config.reference.html

    0 讨论(0)
提交回复
热议问题