JasperSoft Studio中带子报表的动态标头

时间:2016-08-09 11:55:06

标签: jasper-reports subreport

我的报告包含许多子报告。每个都有不同的宽度,所以我需要设置一个标题,该标题占用最宽的子报告的长度。

我将一个文本字段(如标题)添加到“页面标题”区域(也在“标题”区域中,但结果相同),我尝试设置不同的属性(拉伸类型,细节溢出.. 。)但文本字段宽度保持不变。

我失败了什么属性?

enter image description here

如何看到标题是蓝色的行,但是他的宽度与下面的子报表宽度不同。

的.jrxml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.0.final using JasperReports Library version 6.1.0  -->
<!-- 2016-08-09T14:35:08 -->
<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="reportAutocertificazioniDocProbaSpesa" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="776a21e5-d931-4e5f-be08-e1796cec8b1c">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="collectionFatture" class="java.util.ArrayList">
        <parameterDescription><![CDATA[]]></parameterDescription>
    </parameter>
    <parameter name="SUBREPORT_PROBA_DIR" class="java.lang.String"/>
    <parameter name="ente" class="java.lang.String"/>
    <parameter name="CUP" class="java.lang.String"/>
    <parameter name="collectionDetermine" class="java.util.ArrayList"/>
    <parameter name="collectionMandati" class="java.util.ArrayList"/>
    <parameter name="collectionAL" class="java.util.ArrayList"/>
    <parameter name="collectionANL" class="java.util.ArrayList"/>
    <parameter name="SUBREPORT_AUTOCERT_DIR" class="java.lang.String"/>
    <parameter name="importoVociLavoriQuotaMIUR" class="java.math.BigDecimal"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
        </band>
    </background>
    <pageHeader>
        <band height="60" splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" mode="Opaque" x="0" y="0" width="842" height="60" isPrintWhenDetailOverflows="true" backcolor="#009FC5" uuid="f5a3fea3-1efe-416a-8ee0-86b2fb2e1726">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <box>
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                    <rightPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Dettaglio autocertificazioni e documentazione probatoria - "+$P{CUP}+" - "+$P{ente}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
        </band>
    </columnHeader>
    <detail>
        <band height="60">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <subreport>
                <reportElement x="0" y="0" width="841" height="60" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="daa09642-95c6-4e72-bba3-89c9f6dd6b93">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_PROBA_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="ente">
                    <subreportParameterExpression><![CDATA[$P{ente}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="CUP">
                    <subreportParameterExpression><![CDATA[$P{CUP}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{collectionFatture})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_PROBA_DIR} + "reportDocumentazioneProbatoriaFTXLS.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="60">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <subreport>
                <reportElement x="0" y="0" width="841" height="60" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="123b41d9-6094-4ca3-9d28-f30935ef4423"/>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_PROBA_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="ente">
                    <subreportParameterExpression><![CDATA[$P{ente}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="CUP">
                    <subreportParameterExpression><![CDATA[$P{CUP}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{collectionDetermine})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_PROBA_DIR} + "reportDocumentazioneProbatoriaDTXLS.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="60">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <subreport>
                <reportElement x="0" y="0" width="841" height="60" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="53f43657-f8fa-4cc3-aaf4-228e3d790d5b"/>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_PROBA_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="ente">
                    <subreportParameterExpression><![CDATA[$P{ente}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="CUP">
                    <subreportParameterExpression><![CDATA[$P{CUP}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{collectionMandati})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_PROBA_DIR} + "reportDocumentazioneProbatoriaMQXLS.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="60">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <subreport>
                <reportElement x="0" y="0" width="841" height="60" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="1aa39919-9589-4354-8b35-ce05cce8aaeb">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <subreportParameter name="importoVociLavoriQuotaMIUR">
                    <subreportParameterExpression><![CDATA[$P{importoVociLavoriQuotaMIUR}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{collectionAL})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_AUTOCERT_DIR} + "reportALXLS.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="60">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <subreport>
                <reportElement x="0" y="0" width="840" height="60" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="be9393d0-79f1-4f40-b163-42334202e699">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <subreportParameter name="importoVociLavoriQuotaMIUR">
                    <subreportParameterExpression><![CDATA[$P{importoVociLavoriQuotaMIUR}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{collectionANL})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_AUTOCERT_DIR} + "reportANLXLS.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
        </band>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
        </band>
    </pageFooter>
</jasperReport>

0 个答案:

没有答案