【问题标题】:stretch a row to fit the data in jasper reports using iReport使用 iReport 拉伸一行以适应 jasper 报告中的数据
【发布时间】:2017-04-19 18:53:04
【问题描述】:

如何拉伸文本字段以适应数据,如果数据超过带高,则文本字段不会拉伸。我已经在我的 jrxml 中添加了文本字段标签...

例子:

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
    <reportElement
                    style="dNew"
                    mode="Opaque"
                    x="200"
                    y="0"
                    width="200"
                    height="19"
                    key="value-2"
                    stretchType="RelativeToTallestObject"
                    positionType="Float"
                    isPrintInFirstWholeBand="true"
                    isPrintWhenDetailOverflows="true"/>
    <box></box>
    <textElement textAlignment="Center" verticalAlignment="Top">
        <font fontName="Arial" pdfFontName="Helvetica"/>
    </textElement>
    <textFieldExpression   class="java.lang.String"><![CDATA[$F{DATA2}]]></textFieldExpression>
</textField>

【问题讨论】:

    标签: jasper-reports ireport


    【解决方案1】:

    有些条带不会拉伸,但如果您谈论的是细节条带,您可以这样做:

    <textField isStretchWithOverflow="true" isBlankWhenNull="true">
        <reportElement style="base" positionType="Float" 
           isPrintRepeatedValues="false" x="0" y="3" 
           width="380" height="26" isRemoveLineWhenBlank="true"/>
        <textElement/>
        <textFieldExpression class="java.lang.String">
           <![CDATA[$P{information}]]></textFieldExpression>
    </textField>
    

    这是从自动生成的 XML 粘贴的,所以有很多额外的东西,但是 isStretchWithOverflow="true" 应该适合你。这将使该字段在文本填满时向下延伸。

    我通常使用 iReport 来构建我的报告,它运行良好。您也可以在其中切换到 XML 视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多