在同一组页脚中的另一个拉伸区域下方拉伸字段

时间:2018-05-09 12:08:40

标签: jasper-reports

背景

我有一份报告,其中完成的分析应该显示在杰出的工作之下。我已将完成的分析设置为浮动

enter image description here

如果有大量已完成的工作,该字段似乎拉伸但不打印信息

enter image description here

我将此完成的分析字段更改为相对于顶部固定,现在它打印所有信息,但如果“未完成”字段展开则重叠

enter image description here

提前感谢任何可以提供帮助的人。

SQL

create table analyses (ID int not null IDENTITY PRIMARY KEY, info1 varchar(max), info2 varchar(max))

insert into analyses values ('short string', 'short string')
insert into analyses values ('Extremely long string which is so long that I don''t know how I can carry on thinking of things to write so I will just keep writing things like this until I get bored and eventually it will be long enough I think, well probably, not entirely sure','Extremely long string which is so long that I don''t know how I can carry on thinking of things to write so I will just keep writing things like this until I get bored and eventually it will be long enough I think, well probably, not entirely sure')
insert into analyses values ('another short string', 'another short string')

JRXML

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.3.final using JasperReports Library version 5.0.1  -->
<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="Blank_A4_3" pageWidth="400" pageHeight="842" columnWidth="360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7f2b0070-ae21-43b8-aed2-2d97e01f5788">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <queryString>
        <![CDATA[select * from analyses]]>
    </queryString>
    <field name="ID" class="java.lang.Integer"/>
    <field name="Info1" class="java.lang.String"/>
    <field name="Info2" class="java.lang.String"/>
    <group name="Group1">
        <groupExpression><![CDATA[$F{ID}]]></groupExpression>
        <groupHeader>
            <band height="24">
                <staticText>
                    <reportElement x="188" y="0" width="62" height="24" uuid="c63aa7bc-0916-4bc4-b00a-2b2f7e0ecdc1">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    </reportElement>
                    <text><![CDATA[Info 1   +]]></text>
                </staticText>
                <staticText>
                    <reportElement x="251" y="0" width="68" height="24" forecolor="#EB3431" uuid="4915813a-f96b-4bd4-a278-5d51378419f5">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    </reportElement>
                    <text><![CDATA[Info 2]]></text>
                </staticText>
                <staticText>
                    <reportElement x="0" y="0" width="188" height="24" uuid="94aa55be-e050-4488-933d-d29497fe1adb">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    </reportElement>
                    <text><![CDATA[ID]]></text>
                </staticText>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="24">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
                <textField>
                    <reportElement x="0" y="0" width="185" height="12" uuid="5b4f1d89-0191-4607-bca5-715d3828bbaa">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    </reportElement>
                    <textElement>
                        <font size="8"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true">
                    <reportElement x="185" y="0" width="135" height="12" uuid="ac96f759-7c22-4877-afb1-a7529d61a067">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    </reportElement>
                    <textElement>
                        <font size="8"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{Info1}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true">
                    <reportElement positionType="Float" x="185" y="12" width="135" height="12" forecolor="#EB221E" uuid="44747f9d-582d-4b46-a729-104a0f5c7eaa">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    </reportElement>
                    <textElement>
                        <font size="8"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{Info2}]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
</jasperReport>

1 个答案:

答案 0 :(得分:0)

对于“已完成”文本字段:

  • 选择职位类型='浮动'
  • 选择stretch type ='No Stretch'
  • 确保选中'Stretch with Overflow'选项(true)
相关问题