我有这组记录:
颜色表。
color_group | color_name | color_no
Primary | Red | 1
Primary | Blue | 3
Primary | Yellow | 2
Secondary | Green | 8
Secondary | Violet | 1
Secondary | Orange | 7
Others | Pink | 6
Others | White | 4
Others | Black | 5
我想生成这样的报告。
Primary
Red 1
Blue 3
Yellow 2
Secondary
Green 8
Violet 1
Orange 7
Others
Pink 6
White 5
Black 4
如何在jasper报告中以这样的方式显示它?
答案 0 :(得分:2)
这是通过在color_group
字段上使用组并添加groupHeader
频段来显示其值来解决的。
示例强>
<?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="group" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c1d9b4b7-6162-4b17-b871-3cf3b867d1ef">
<field name="color_group" class="java.lang.String"/>
<field name="color_name" class="java.lang.String"/>
<field name="color_no" class="java.lang.Integer"/>
<group name="colorGroup">
<groupExpression><![CDATA[$F{color_group}]]></groupExpression>
<groupHeader>
<band height="20">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="e98d6fc1-1ecd-4af4-8250-d8aaa497011e"/>
<textFieldExpression><![CDATA[$F{color_group}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="20" y="0" width="100" height="20" uuid="7ca1ac35-6249-4ba6-ac87-031f8d410d2e"/>
<textFieldExpression><![CDATA[$F{color_name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="120" y="0" width="100" height="20" uuid="395b0cdd-4d2c-4d0b-93cd-7cad6daf3a4b"/>
<textFieldExpression><![CDATA[$F{color_no}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
<强>结果强>
答案 1 :(得分:0)
据我所知,这是在iReport中创建和使用组的过程。
var s = "•";
alert(s.charCodeAt(0))