Merging the cells which have same data

只谈情不闲聊 提交于 2020-08-19 16:49:27

问题


I have a report which has the columns Type,S.No,Date.Here the Type column will have the same value for all rows.So i just want to merge all the cells of Type column.I have referred the below link

Group several same value field into a single cell and tried with their suggestion.But if i do like that i am getting like in below imageenter image description here.

Edit:

Below is the code i am using in my jrxml for merging the cells which have same data.

<field name="type" class="java.lang.String"/>
<group name="type">
        <groupExpression><![CDATA[$F{type}]]></groupExpression>
    </group>

In detail band i tried by creating the fake statictext behind the type textfield like below.

            <staticText>
                <reportElement x="0" y="0" width="121" height="20"/>
                <box>
                    <leftPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textElement/>
                <text><![CDATA[]]></text>
            </staticText>
            <textField>
                <reportElement isPrintRepeatedValues="false" x="0" y="0" width="121" height="20"/>
                <box>
                    <topPen lineWidth="0.0"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.0"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$F{type}]]></textFieldExpression>
            </textField>

But no use. Tried by using printWhenExpression in type textfield like below.

<textField>
                <reportElement x="0" y="0" width="121" height="20">
                    <printWhenExpression><![CDATA[$V{type_COUNT} == 1]]></printWhenExpression>
                </reportElement>
                <box>
                    <topPen lineWidth="0.0"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.0"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$F{type}]]></textFieldExpression>
            </textField>

But no use.

If i add the bottom border for static text then the image looks like below.

enter image description here

Thank You.


回答1:


Add the bottom border in GroupFooter band for group "type"



来源:https://stackoverflow.com/questions/18851742/merging-the-cells-which-have-same-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!