aaaa
aaaa

Reputation: 487

Merging the cells which have same data

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.

Upvotes: 3

Views: 8748

Answers (1)

murison
murison

Reputation: 3983

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

Upvotes: 1

Related Questions