Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 514
aaaa Avatar asked Mar 28 '26 14:03

aaaa


1 Answers

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

like image 165
murison Avatar answered Apr 02 '26 22:04

murison