I want to place a total column of ireports crosstab at a fixed/user defined position, but can not find any resolution yet (iReport 4.1.3).
Is it possible to do this? If no, is there any work around?
To test i just use the example described in iReport manual (2013).
Every tip is very appriciated. Many thanks in advance.
Attached are the source and picture
<?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="test" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.771561000000001"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<queryString>
<![CDATA[select * from orders]]>
</queryString>
<field name="ORDERID" class="java.lang.Integer"/>
<field name="CUSTOMERID" class="java.lang.String"/>
<field name="EMPLOYEEID" class="java.lang.Integer"/>
<field name="ORDERDATE" class="java.sql.Timestamp"/>
<field name="REQUIREDDATE" class="java.sql.Timestamp"/>
<field name="SHIPPEDDATE" class="java.sql.Timestamp"/>
<field name="SHIPVIA" class="java.lang.Integer"/>
<field name="FREIGHT" class="java.math.BigDecimal"/>
<field name="SHIPNAME" class="java.lang.String"/>
<field name="SHIPADDRESS" class="java.lang.String"/>
<field name="SHIPCITY" class="java.lang.String"/>
<field name="SHIPREGION" class="java.lang.String"/>
<field name="SHIPPOSTALCODE" class="java.lang.String"/>
<field name="SHIPCOUNTRY" class="java.lang.String"/>
<summary>
<band height="49" splitType="Stretch">
<crosstab>
<reportElement x="0" y="30" width="555" height="19"/>
<rowGroup name="SHIPCITY" width="70" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{SHIPCITY}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{SHIPCITY}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement x="0" y="0" width="70" height="25"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total SHIPCITY]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="SHIPPEDDATE" height="30" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[(new SimpleDateFormat("yyyy")).format($F{SHIPPEDDATE})]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$V{SHIPPEDDATE}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement x="0" y="0" width="50" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total SHIPPEDDATE]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="ORDERIDMeasure" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{ORDERID}]]></measureExpression>
</measure>
<crosstabCell width="50" height="25">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="SHIPCITY">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="SHIPPEDDATE">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="SHIPCITY" columnTotalGroup="SHIPPEDDATE">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
<staticText>
<reportElement x="0" y="3" width="70" height="20"/>
<box leftPadding="3">
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement>
<font size="9"/>
</textElement>
<text><![CDATA[City]]></text>
</staticText>
<staticText>
<reportElement x="450" y="3" width="75" height="20"/>
<box leftPadding="3">
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement>
<font size="9"/>
</textElement>
<text><![CDATA[Total SHIPPED]]></text>
</staticText>
<staticText>
<reportElement x="70" y="3" width="380" height="20"/>
<box leftPadding="3">
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement>
<font size="9"/>
</textElement>
<text><![CDATA[Dynamic columns...]]></text>
</staticText>
</band>
</summary>
</jasperReport>
0 Answers:
No answers yet