如何在列标题,页脚和细节部分周围绘制边框?

Pas*_*ert 11 jasper-reports

我要求有一个边框,它将封装JasperReports + iReport中生成的报告中的所有细节+列标题.但是,如果我尝试在列标题,详细信息和列页脚中绘制一个rect或一个框架,我会收到一条错误消息,指出元素位置无效.

我想一个选择是使用图像(就像没有CSS的好旧HTML时间......)但它会是PITA,因为如果字段溢出或者有人改变了部分的高度或宽度,图像将必须改变......

还有其他选择吗?

谢谢.

Gen*_*Jon 10

为此,您可以将帧放入每个波段,设置它们的大小以完全填充波段.然后在帧上设置边框以复制所有三个波段周围的边框,因此标题在顶部,左侧和右侧有一个边框; 页脚有底部,左侧和右侧; 并且细节带仅在左侧和右侧具有边框.请参阅下面的示例代码.

<columnHeader>
    <band height="61" splitType="Stretch">
        <frame>
            <reportElement x="0" y="0" width="555" height="61"/>
            <box>
                <topPen lineWidth="2.0" lineStyle="Solid"/>
                <leftPen lineWidth="2.0" lineStyle="Solid"/>
                <rightPen lineWidth="2.0" lineStyle="Solid"/>
            </box>
        </frame>
    </band>
</columnHeader>
<detail>
    <band height="125" splitType="Stretch">
        <frame>
            <reportElement x="0" y="0" width="555" height="125"/>
            <box>
                <leftPen lineWidth="2.0" lineStyle="Solid"/>
                <rightPen lineWidth="2.0" lineStyle="Solid"/>
            </box>
        </frame>
    </band>
</detail>
<columnFooter>
    <band height="45" splitType="Stretch">
        <frame>
            <reportElement x="0" y="0" width="555" height="45"/>
            <box>
                <leftPen lineWidth="2.0" lineStyle="Solid"/>
                <bottomPen lineWidth="2.0" lineStyle="Solid"/>
                <rightPen lineWidth="2.0" lineStyle="Solid"/>
            </box>
        </frame>
    </band>
</columnFooter>
Run Code Online (Sandbox Code Playgroud)

结果应如下所示: iReport的屏幕截图