如何在JasperReports 3.5.2中展开textFields?

时间:2017-07-26 08:53:33

标签: jasper-reports

我使用的是JaspeReports 3.5.2。

我想垂直拉伸我的字段,基本上如果某些文字太长我想要包装它,然后我想要向下移动所有字段。

原样: enter image description here

要成为: enter image description here

有可能吗?如果版本3.5.2中的Jasper支持这样的事情吗?

我读到了这个问题,很多人都说:

  1. 每个字段都必须使用isStretchWithOverflow="true"
  2. 每个reportElement都必须使用positionType="Float"stretchType="RelativeToTallestObject"

  3. 最后一个:我必须按行分组我的元素

  4. 这是我的代码:

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Report" pageWidth="612" pageHeight="842" columnWidth="552" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="30">
          <style name="normal" isDefault="true" fontName="Lucida Sans Typewriter" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
           <pageHeader>
                 <band height="300" splitType="Stretch">
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="189" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="189" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="189" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="189" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                        </elementGroup>
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="199" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="199" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="199" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="199" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                        </elementGroup>
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="209" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="209" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="209" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="209" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                        </elementGroup>
    
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="219" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="219" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="219" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="219" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                        </elementGroup>
    
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="229" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="229" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="229" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="229" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                        </elementGroup>
                        <elementGroup>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="1" y="239" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="131" y="239" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField>
                            <textField evaluationTime="Report" isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="300" y="239" width="130" height="18" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font isBold="true" size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["Value"]]></textFieldExpression>
                            </textField>
                            <textField isBlankWhenNull="true" isStretchWithOverflow="true">
                               <reportElement key="textField" style="normal" mode="Transparent" x="430" y="239" width="173" height="16" positionType="Float" stretchType="RelativeToTallestObject"/>
                               <textElement>
                                      <font size="7"/>
                               </textElement>
                               <textFieldExpression class="java.lang.String"><![CDATA["aaa"]]></textFieldExpression>
                            </textField> 
                        </elementGroup>
                 </band>       
           </pageHeader>
    </jasperReport>
    

0 个答案:

没有答案