根据jr:table的条件更改单元格高度

时间:2017-06-27 09:08:03

标签: jasper-reports

我有一个由以下样式组成的表:

<style name="StyleRowType" mode="Opaque" forecolor="#000000" backcolor="#FFFFFF">
    <conditionalStyle>
        <conditionExpression><![CDATA["HEADER".equals($F{CODE_TIPO_RIGA})]]></conditionExpression>
        <style forecolor="#FFFFFF" backcolor="#003D90" hTextAlign="Center" isBold="true"/>
    </conditionalStyle>
    <conditionalStyle>
        <conditionExpression><![CDATA["DETAIL".equals($F{CODE_TIPO_RIGA})]]></conditionExpression>
        <style forecolor="#000000" backcolor="#FFFFFF" hTextAlign="Right" isBold="false"/>
    </conditionalStyle>
    <conditionalStyle>
        <conditionExpression><![CDATA["SUBTOTAL".equals($F{CODE_TIPO_RIGA})]]></conditionExpression>
        <style forecolor="#000000" backcolor="#C6C3C6" hTextAlign="Right" isBold="true"/>
    </conditionalStyle>
    <conditionalStyle>
        <conditionExpression><![CDATA["TOTAL".equals($F{CODE_TIPO_RIGA})]]></conditionExpression>
        <style forecolor="#000000" backcolor="#999999" hTextAlign="Right" isBold="true"/>
    </conditionalStyle>
</style>

    <style name="Table 9_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>


<componentElement>
                    <reportElement x="592" y="-78" width="220" height="165" uuid="819fc066-05d6-4ce7-9f7a-eb5067eecb89">
                        <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                        <property name="com.jaspersoft.studio.table.style.table_header" value="Table 9_TH"/>
                        <property name="com.jaspersoft.studio.table.style.column_header" value="Table 9_CH"/>
                        <property name="com.jaspersoft.studio.table.style.detail" value="Table 9_TD"/>
                    </reportElement>
                    <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                        <datasetRun subDataset="PRELIEVI_ATM" uuid="b5d2c1ab-3db7-4018-90d1-69036b48e46d">
                            <datasetParameter name="UID_REPORT_Q1">
                                <datasetParameterExpression><![CDATA[$P{UID_REPORT}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="ATTR_PATH_ROOT_Q1">
                                <datasetParameterExpression><![CDATA[$P{ATTR_PATH_ROOT}+"/themes/images/delta.png"]]></datasetParameterExpression>
                            </datasetParameter>
                            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        </datasetRun>
                        <jr:column width="90" uuid="ef78e814-4dfb-47c8-89f5-629d6b86dcbf">
                            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                            <jr:detailCell style="Table 9_TD" height="14">
                                <property name="com.jaspersoft.studio.unit.height" value="px"/>
                                <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
                                <box>
                                    <pen lineWidth="1.0" lineStyle="Double" lineColor="#FFFFFF"/>
                                </box>
                                <textField>
                                    <reportElement key="" style="StyleRowType" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="14" uuid="066f4604-06b8-498e-84eb-cc4ee5f214a8"/>
                                    <box>
                                        <pen lineWidth="1.0" lineStyle="Double" lineColor="#FFFFFF"/>
                                    </box>
                                    <textElement>
                                        <font size="8"/>
                                    </textElement>
                                    <textFieldExpression><![CDATA[$F{ATTR_VAL_MESE_ANNO_PREC}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="130" uuid="451b85b2-159e-4241-956c-ea9a2eebe911">
                            <jr:detailCell style="Table 9_TD" height="14">
                                <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
                                <box>
                                    <pen lineWidth="1.0" lineStyle="Double" lineColor="#FFFFFF"/>
                                </box>

有没有办法改变蓝色单元格“HEADER”的高度并保持其他单元不变?现在,如果我改变StyleRowType的高度,将涉及所有单元格。

enter image description here

0 个答案:

没有答案