【问题标题】:Merging the cells which have same data合并具有相同数据的单元格
【发布时间】:2013-09-17 13:48:31
【问题描述】:

我有一个报告,其中包含 Type、S.No、Date 列。这里的 Type 列对于所有行都具有相同的值。所以我只想合并 Type 列的所有单元格。我参考了以下内容链接

Group several same value field into a single cell 并尝试了他们的建议。但如果我这样做,我就会像下面的图片。

编辑:

下面是我在 jrxml 中用于合并具有相同数据的单元格的代码。

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

我尝试通过在下面的类型文本字段后面创建假静态文本来详细说明乐队。

            <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。

<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>

但没用。

如果我为静态文本添加底部边框,则图像如下所示。

谢谢。

【问题讨论】:

  • 嗨,Alex,感谢您的回复。在我的图像中,单元格已合并,但我没有得到交货单文本的底部边框。
  • 您是否在Delivery Note 后面添加了“假”文本字段?你能发布 jrxml 文件吗?
  • 嗨,Alex,我已经用我尝试过的代码编辑了我的原始问题。请查看并纠正我做错的地方。谢谢。

标签: jasper-reports


【解决方案1】:

在 GroupFooter 带中为组“类型”添加底部边框

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-20
    • 1970-01-01
    • 1970-01-01
    • 2019-10-28
    • 1970-01-01
    • 2022-01-01
    • 1970-01-01
    相关资源
    最近更新 更多