3
votes

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
Hi Alex,Thank you for giving the reply.In my image the cells are merged but i am not getting the bottom border for Delivery Note text.aaaa
Did you add the "fake" textField behind the Delivery Note? Can you post the jrxml file?Alex K
Hi Alex,I have edited my original question with the code with what i tried.Please look into it and correct me where i am doing wrong.Thank You.aaaa

1 Answers

1
votes

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