在jasperreports中添加表边框 [英] Adding table border in jasperreports

查看:190
本文介绍了在jasperreports中添加表边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用类似数据的表创建报告?

How do you create a report with table like data?

我能够创建一个包含以下详细信息的报告。它以类似表格的结构排列数据。

I was able to create a report with details below. It arranges the data in a table-like structure.

<jasperReport>  
.
.
    <pageHeader>
        <band height="30">
            <staticText>
                <reportElement x="0" y="0" width="69" height="24" />
                <textElement verticalAlignment="Bottom" />
                <text><![CDATA[ID: ]]></text>
            </staticText>
            <staticText>
                <reportElement x="140" y="0" width="69" height="24" />
                <textElement verticalAlignment="Bottom" />
                <text><![CDATA[NAME: ]]></text>
            </staticText>
            <staticText>
                <reportElement x="280" y="0" width="69" height="24" />
                <textElement verticalAlignment="Bottom" />
                <text><![CDATA[AGE: ]]></text>
            </staticText>
        </band>
    </pageHeader>
    <detail>
        <band height="30">
            <textField>
                <reportElement x="0" y="0" width="69" height="24" />
                <textFieldExpression class="java.lang.String"><![CDATA[$F{id}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="140" y="0" width="69" height="24" />
                <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="280" y="0" width="69" height="24" />
                <textFieldExpression class="java.lang.String"><![CDATA[$F{age}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

但行和列没有边框?如何在Jasperreport 4.5中实现这一目标?

But the rows and columns has no border? How do I achieve this in Jasperreport 4.5?

谢谢

推荐答案


  • 您可以借助GUI设计器(例如 iReport )添加边框,也可以添加 元素手动(编辑 jrxml 文件),如下例所示:

    • You can add borders with help of GUI designer (iReport, for example) or you can add the box element manually (edit the jrxml file) like in this sample:
    • <textField>
          <reportElement x="29" y="17" width="100" height="20"/>
          <box>
              <topPen lineWidth="1.0"/>
              <leftPen lineWidth="1.0"/>
              <bottomPen lineWidth="1.0"/>
              <rightPen lineWidth="1.0"/>
          </box>
          <textElement/>
          <textFieldExpression><![CDATA[$F{field}]]></textFieldExpression>
      </textField>
      




      • iReport 中你可以使用填充和边框上下文菜单。

        • In iReport you can use "Padding And Borders" context menu.

          Jaspersoft Studio 中,您可以在属性对话框的帮助下设置边框(选项卡边框)。

          In Jaspersoft Studio you can set borders with help of Properties dialog (tab Borders).

          这篇关于在jasperreports中添加表边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆