如何在JasperReports模板文件(JRXML)中添加注释。我需要在每个乐队中添加一些评论来描述波段的功能,还需要为子报告编写一些注释。那么,如何向jrxml文件中添加注释呢?
发布于 2013-08-12 13:48:21
使用iReport设计器工具中的标注功能
自从iReport 3.7.1以来,添加了一个名为标注的元素,特别是为了满足注释的要求。
转到-> iReport designer中的Window菜单。这些“标注”的工作方式类似于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"/>在(iReport)中,注释如下:

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

对于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>我在这个jrxml文件中为字段、textField和Band添加了“注释”。
您可以在在iReport .jrxml文件中保留XML注释? post中找到替代方法
发布于 2013-08-12 12:59:12
<!-- this is a comment -->将在jrxml中工作。
https://stackoverflow.com/questions/18187014
复制相似问题