合并具有相同数据的单元格 [英] Merging the cells which have same data
问题描述
我有一个报表,其中有Type,S.No,Date列.这里Type列的所有行都具有相同的值.所以我只想合并Type列的所有单元格.链接
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 image.
下面是我在jrxml中用于合并具有相同数据的单元格的代码.
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>
但是没有用. 通过在文本字段类型中使用printWhenExpression进行尝试,如下所示.
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>
但是没有用.
如果我为静态文本添加底部边框,则图像如下图所示.
If i add the bottom border for static text then the image looks like below.
谢谢.
推荐答案
为类型"组在GroupFooter带中添加底边框
Add the bottom border in GroupFooter band for group "type"
这篇关于合并具有相同数据的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!