Jasper reports 如何使用矩形获取报表列标题的边框

Jasper reports 如何使用矩形获取报表列标题的边框,jasper-reports,ireport,Jasper Reports,Ireport,我正在使用ireport-4.5.0,jasper-reports-4.5.0。我正在尝试将边框添加到列标题。在谷歌搜索时,我发现我们可以使用矩形来获取边框。我使用了矩形,但没有获取边框。下面是我正在使用的代码 <columnHeader> <band height="39" splitType="Stretch"> <rectangle> <reportElement x="131

我正在使用ireport-4.5.0,jasper-reports-4.5.0。我正在尝试将边框添加到列标题。在谷歌搜索时,我发现我们可以使用矩形来获取边框。我使用了矩形,但没有获取边框。下面是我正在使用的代码

<columnHeader>
        <band height="39" splitType="Stretch">
            <rectangle>
                <reportElement x="131" y="0" width="424" height="39"/>
            </rectangle>
            <rectangle>
                <reportElement x="0" y="1" width="131" height="38"/>
            </rectangle>
            <staticText>
                <reportElement x="11" y="16" width="108" height="14"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Business Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="154" y="10" width="361" height="20"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Sales Report]]></text>
            </staticText>
        </band>
    </columnHeader>

有人能告诉我在哪里犯了错误吗


提前感谢。

问题是矩形需要比字段大一点。如果您想到层,您的文本框位于矩形的顶部,这就是为什么您看不到矩形的原因。使用边框效果更好。只需右键单击对象并转到“填充和边框”


为每个静态文本字段使用两个矩形。 尝试此操作,但我只对中心文本执行了以下操作:-

<columnHeader>
    <band height="39" splitType="Stretch">
        <rectangle>
            <reportElement x="131" y="0" width="424" height="39" backcolor="#FF6666"/>
        </rectangle>
        <rectangle>
            <reportElement x="134" y="3" width="419" height="31"/>
        </rectangle>
        <staticText>
            <reportElement x="154" y="10" width="361" height="20"/>
            <textElement textAlignment="Center">
                <font size="12" isBold="true"/>
            </textElement>
            <text><![CDATA[Sales Report]]></text>
        </staticText>
    </band>
</columnHeader>


您可以查看postHi Alex,我不想使用填充和边框。我只需要使用矩形。我已经编辑了我的原始问题。Bcoz我还需要将边框添加到子报表中。我想我们没有子报表的填充和边框。所以我只需要使用矩形。你能发布屏幕截图吗?你的示例可以使用PDF和XHTML,但在标准HTML中工作矩形丢失了。框架可能是解决HTML问题的一种方法,但它们也会使用填充和边框。我不清楚你是如何没有填充边框的。你好,Mnoland。我不想使用填充和边框。我只需要使用矩形。我已经尝试过让矩形的大小大于字段。但是我仍然没有得到边框。我已经编辑了我的原始问题。你能看看吗。谢谢
<columnHeader>
    <band height="39" splitType="Stretch">
        <rectangle>
            <reportElement x="131" y="0" width="424" height="39" backcolor="#FF6666"/>
        </rectangle>
        <rectangle>
            <reportElement x="134" y="3" width="419" height="31"/>
        </rectangle>
        <staticText>
            <reportElement x="154" y="10" width="361" height="20"/>
            <textElement textAlignment="Center">
                <font size="12" isBold="true"/>
            </textElement>
            <text><![CDATA[Sales Report]]></text>
        </staticText>
    </band>
</columnHeader>