如何在JasperReports模板文件(JRXML)中添加注释.我需要在每个乐队中添加一些注释来描述乐队的功能,还需要为子报表编写一些注释.那么如何在jrxml文件中添加注释?
从iReport 3.7.1开始,有一个名为Callouts的元素被添加,特别是为了迎合评论条款.
转到iReport设计器中的Window - > Pallete菜单.这些"Callouts"就像iReport界面中的便签一样,在生成的XML中看起来像这样:
<property name="ireport.callouts" value="##Mon Aug 12 18:03:15 MSK 2013\ncallouts.2.text=This is Detail band\ncallouts.1.text=This is Title Band\ncallouts.2.bounds=353,118,150,75\ncallouts.1.bounds=34,17,239,83"/>
Run Code Online (Sandbox Code Playgroud)
在GUI设计器(iReport)中,注释如下:

有关更多详细信息,请参阅http://community.jaspersoft.com上的iReport帖子删除jrxml中的注释
在JasperReports ( iReport )的早期版本中没有这样的内置机会。
例如,我们可以使用“自定义属性”机制来解决这个问题。
在下面的示例中,我展示了如何在iReport中添加字段的属性Description。

对于 band,我们可以手动添加属性(将行添加到jrxml文件)。
具有自定义属性的jrxml文件示例:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sample_comments" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0dfb0d3b-8128-4f2d-b12a-9b5edac0f460">
<property name="Desription" value="This is a sample of report with comments. The custom properties are used"/>
<queryString>
<![CDATA[SELECT id, city FROM address]]>
</queryString>
<field name="ID" class="java.lang.Integer">
<property name="Description" value="The identificator"/>
</field>
<field name="CITY" class="java.lang.String"/>
<title>
<band height="79" splitType="Stretch"/>
</title>
<columnHeader>
<band height="20" splitType="Stretch">
<property name="Description" value="Column header Band"/>
<staticText>
<reportElement uuid="8c120f11-e5bf-40e1-9234-3bcede068949" x="0" y="0" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Id]]></text>
</staticText>
<staticText>
<reportElement uuid="c8c11f63-d12d-4fbf-b146-dc3d95071065" x="100" y="0" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[City]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="402fcbe3-ef31-475b-8d0f-9da66c3a0692" x="0" y="0" width="100" height="20">
<property name="Description" value="Contains the Id field"/>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="96bd13a6-a90e-46c6-8c43-ca45b2b7db1d" x="100" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Run Code Online (Sandbox Code Playgroud)
在这个jrxml文件中,我为字段、textField和 Band 添加了“注释”。
您可以在在 iReport .jrxml 文件中保留 XML 注释中找到替代方法吗?邮政
<!-- this is a comment -->
Run Code Online (Sandbox Code Playgroud)
将在 jrxml 中工作。
| 归档时间: |
|
| 查看次数: |
8398 次 |
| 最近记录: |