本文介绍了拉伸溢出细节带无法按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一份简单的报告。它有两个乐队的标题和细节。
标题中我有一个静态文本,在详细信息中我有一个 textField

I have a simple report. It has two bands title and detail.In the Title I have a static text, in the Detail I have one textField.

textField 设置为 stretchwithoverflow =true 。如果我将此字段的高度设置为适合一个原始信息,我会得到一个半行的较大信息。所以一个 textField ,在 textField 中我有2行信息,第一行显示正确,第二行 - 我可以看到半高。

The textField is set to stretchwithoverflow = "true". If I set the height for this field to fit one raw information, I get for the larger information one and a half rows. So one textField, in the textField I have 2 rows information, first row displayed correctly, second one - I can see a half height.

可以这样做吗?仅扩展包含较大信息的行,较大的信息将很好地适合文本字段?

Can this be done? Expand only the rows that contain larger information and the larger information will fit well in the text field?

<?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="report7" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="15f9d2dd-21ce-41ec-bcb8-c1aca3a77e37">
    <parameter name="EndDate" class="java.util.Date">
        <defaultValueExpression><![CDATA[new java.util.Date()]]></defaultValueExpression>
    </parameter>
    <parameter name="Project" class="java.util.Collection"/>
    <parameter name="Severity" class="java.util.Collection"/>
    <parameter name="StartDate" class="java.util.Date">
        <defaultValueExpression><![CDATA[new java.util.Date(112, 0, 01)]]></defaultValueExpression>
    </parameter>
    <parameter name="Project_Sets" class="java.util.Collection"/>
    <queryString>
        <![CDATA[some query]]>
    </queryString>
    <field name="crid" class="java.lang.String"/>
    <field name="SEVER" class="java.lang.String"/>
    <field name="product" class="java.lang.String"/>
    <field name="state" class="java.lang.String"/>
    <field name="status" class="java.lang.String"/>
    <field name="submit_date" class="java.lang.String"/>
    <field name="aging" class="java.lang.Long"/>
    <title>
        <band height="25" splitType="Stretch">
            <staticText>
                <reportElement uuid="63eef93a-7e8f-4c69-b9d6-4447fe90673d" x="0" y="0" width="555" height="25" forecolor="#3399FF"/>
                <textElement textAlignment="Center">
                    <font size="16" isBold="true"/>
                </textElement>
                <text><![CDATA[Defects Aging]]></text>
            </staticText>
        </band>
    </title>
    <columnHeader>
        <band height="32">
            <rectangle>
                <reportElement uuid="9a2288d4-87ce-4ee7-b04e-267a7ee0ea8b" x="0" y="0" width="555" height="32" backcolor="#99CC00"/>
            </rectangle>
            <staticText>
                <reportElement uuid="9281aa7a-4bcc-4456-9f25-83c7b2360a01" x="0" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[CRID]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="cacda134-069c-43ae-abc1-76f5c865df41" x="79" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Severity]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="d798786f-5ee0-4e76-8a35-2f908af6e92c" positionType="Float" x="158" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Product]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="6be4792d-01a5-4d18-940d-90f40417c7ad" positionType="Float" x="237" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[State]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="fa447ca9-121c-43fb-a7bf-1b29ada93adf" positionType="Float" x="316" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Status]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="b2d8f1db-871b-4e34-942f-b8c4a87a358b" positionType="Float" x="395" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Submit Date]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="c3eddc7c-25ca-4e29-a01e-13e856b67d03" x="474" y="0" width="79" height="32" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Days]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="81" splitType="Stretch">
            <elementGroup>
                <textField isStretchWithOverflow="true">
                    <reportElement uuid="6422c6d3-40b9-4e38-8bb4-ded91c91ac17" stretchType="RelativeToBandHeight" x="158" y="0" width="79" height="39"/>
                    <textElement textAlignment="Left" verticalAlignment="Middle"/>
                    <textFieldExpression><![CDATA[$F{product}]]></textFieldExpression>
                </textField>
            </elementGroup>
        </band>
    </detail>
</jasperReport>


推荐答案

如果有更多物品,你可以在同一个乐队中希望所有人都伸展开来。必须将它们所有设置为 stretchType =RelativeToTallestObject并且isStretchWithOverflow =true。

In the same band if there are more items and you want to have all same stretched. It has to be set to all of them to stretchType="RelativeToTallestObject" and isStretchWithOverflow="true".

    <textField isStretchWithOverflow="true" pattern="###0">
            <reportElement stretchType="RelativeToTallestObject" x="1576" y="0" width="91" height="20"/>
            <textElement textAlignment="Center"/>
            <textFieldExpression class="java.lang.Long"><![CDATA[$F{count_tohfa}]]></textFieldExpression>
        </textField>

这篇关于拉伸溢出细节带无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:08