与预期不工作溢出细节带伸展(Stretch with overflow Detail band no

2019-07-03 16:04发布

我有一个简单的报告。 它有两个带标题和细节。 在标题我有一个静态文本,在细节我有一个文本框

文本字段设置为stretchwithoverflow =“真”。 如果我设置高度为这一领域,以适应一个原始信息,我得到了较大的信息一个半行。 所以,一个文本框 ,在文本字段我有2行信息,第一行显示正确,第二个-我可以看到一半的高度。

可以这样做? 展开只包含较大的信息和较大的信息将在文本字段合身行?

<?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>

Answer 1:

在相同的频段,如果有更多的项目,你想拥有所有相同的拉伸。 它被设置为他们 stretchType =“RelativeToTallestObject”和isStretchWithOverflow =“真”。

    <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>


Answer 2:

报告属性:添加此

 net.sf.jasperreports.text.save.line = true net.sf.jasperreports.export.html.wrap.break.word = true 

来源: 自动换行HTML与PDF



文章来源: Stretch with overflow Detail band not working as expected