Variables
它是用来构造表达式的一个特别的值,只要简单的在平台上声明一次 就可以进行各种计算
一个Variables对象可以引用另一个Variables对象.如上所述,Variables可以造建出不同的类型,比如像: count, sum, average 等等
例如 要计算Quantity 的 总和,写法如下:
<variable name="QuantitySum"
class="java.lang.Double" calculation="Sum">
<variableExpression>$F{Quantity}</variableExpression>
</variable>
我们还可设置这个计算范围的级别,它的默认级别中Report ,其他的有page, column or group 还有组
,假如我想计算Quantity每一页的总和,可以这样写:
<variable name="QuantitySum" class="java.lang.Double"
resetType="Page" calculation="Sum">
<variableExpression>$F{Quantity}</variableExpression>
<initialValueExpression>new Double(0) </initialValueExpression>
</variable>
还有一些是系统自带的变量的是
PAGE_NUMBER
COLUMN_NUMBER
REPORT_COUNT
PAGE_COUNT
COLUMN_COUNT
GroupName_COUNT
报表的各个部位
我们在设计报表模板时,先要了解,它的总体结构以及各部位的意义
<background>
<title>
<pageHeader>
<columnHeader>
<groupHeader>
<detail>
<groupFooter>
<columnFooter>
<pageFooter>
<lastPageFooter>
<summary>
<noData>
第个部份都有自已的宽度与高度,并包含一些对象,比如是 lines, rectangles, images 以及 text fields
声明时如下:
<pageHeader>
<band height="30">
<rectangle>
<reportElement x="0" y="0" width="555" height="25"/>
<graphicElement/>
</rectangle>
<staticText>
<reportElement x="0" y="0" width="555" height="25"/>
<textElement textAlignment="Center">
<font fontName="Helvetica" size="18"/>
</textElement>
<text>Northwind Order List</text>
</staticText>
</band>
</pageHeader>
它是用来构造表达式的一个特别的值,只要简单的在平台上声明一次 就可以进行各种计算
一个Variables对象可以引用另一个Variables对象.如上所述,Variables可以造建出不同的类型,比如像: count, sum, average 等等
例如 要计算Quantity 的 总和,写法如下:
<variable name="QuantitySum"
class="java.lang.Double" calculation="Sum">
<variableExpression>$F{Quantity}</variableExpression>
</variable>
我们还可设置这个计算范围的级别,它的默认级别中Report ,其他的有page, column or group 还有组
,假如我想计算Quantity每一页的总和,可以这样写:
<variable name="QuantitySum" class="java.lang.Double"
resetType="Page" calculation="Sum">
<variableExpression>$F{Quantity}</variableExpression>
<initialValueExpression>new Double(0) </initialValueExpression>
</variable>
还有一些是系统自带的变量的是
PAGE_NUMBER
COLUMN_NUMBER
REPORT_COUNT
PAGE_COUNT
COLUMN_COUNT
GroupName_COUNT
报表的各个部位
我们在设计报表模板时,先要了解,它的总体结构以及各部位的意义
<background>
<title>
<pageHeader>
<columnHeader>
<groupHeader>
<detail>
<groupFooter>
<columnFooter>
<pageFooter>
<lastPageFooter>
<summary>
<noData>
第个部份都有自已的宽度与高度,并包含一些对象,比如是 lines, rectangles, images 以及 text fields
声明时如下:
<pageHeader>
<band height="30">
<rectangle>
<reportElement x="0" y="0" width="555" height="25"/>
<graphicElement/>
</rectangle>
<staticText>
<reportElement x="0" y="0" width="555" height="25"/>
<textElement textAlignment="Center">
<font fontName="Helvetica" size="18"/>
</textElement>
<text>Northwind Order List</text>
</staticText>
</band>
</pageHeader>