How to merge the grouped cells in to a single cell?

0

I am using the "group" functionality to group cells belonging to a particular cateory.I need to merged the grouped cells into a single cell so that the text that I need to display covers the entire group instead of a particular cell in the group.

Currently I am using <printWhenExpression><![CDATA[$V{categoryGroup_COUNT} == 1]]></printWhenExpression> to print the grouped category name.

PFB my 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="report1" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0ee13fcf-acf1-435f-a530-1dbe85745536">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<subDataset name="dataset1" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="rule" class="java.lang.String">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset3" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="data" class="java.lang.String">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset2" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="matrix" class="java.util.ArrayList">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset4" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="subCatMatrix" class="java.util.ArrayList">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset5" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="subCategory" class="java.lang.String">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset6" uuid="6850c76b-51b2-4ff5-bd28-30b36e8ee470">
<field name="category" class="java.lang.String">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
<group name="categoryGroup">
<groupExpression><![CDATA[$F{category}]]></groupExpression>
</group>
</subDataset>
<field name="ruleList" class="java.util.ArrayList"/>
<field name="posmatrix" class="java.util.ArrayList"/>
<field name="matrix" class="java.util.ArrayList"/>
<field name="subCategoryList" class="java.util.ArrayList"/>
<field name="subCatMatrix" class="java.util.ArrayList"/>
<field name="categoryList" class="java.util.ArrayList"/>
 
 
<title>
<band height="30" splitType="Stretch">
<staticText>
<reportElement x="321" y="3" width="146" height="20" uuid="226d751d-c052-4d9e-9df9-6d453775a756"/>
<textElement>
<font fontName="Times New Roman" size="14" isBold="true"/>
</textElement>
<text><![CDATA[Position Matrix Report]]></text>
</staticText>
<line>
<reportElement x="26" y="25" width="750" height="1" uuid="a068441b-4723-4ac5-a5ce-326d93a36998"/>
</line>
</band>
</title>
<summary>
<band height="498" splitType="Stretch">
<componentElement>
<reportElement x="300" y="10" width="480" height="10" uuid="3b94bc89-a1ef-4e1f-af94-23e04f1f6884"/>
<datasetRun subDataset="dataset1" uuid="323513d5-9d93-4d95-932b-61127305f920">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{ruleList})]]></dataSourceExpression>
</datasetRun>
<c:listContents height="10" width="30">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="30" height="10" uuid="c1048f8d-a152-40e9-893a-be5bc98578bd"/>
<box leftPadding="10">
<pen lineColor="#000000"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement>
<font fontName="Times New Roman" size="7" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{rule}]]></textFieldExpression>
</textField>
</c:listContents>
</c:list>
</componentElement>
<componentElement>
<reportElement x="300" y="20" width="200" height="10" uuid="b3cff54a-20b6-4f4d-8ac2-fe824379ff0c"/>
<datasetRun subDataset="dataset2" uuid="323513d5-9d93-4d95-932b-61127305f920">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{posmatrix})]]></dataSourceExpression>
</datasetRun>
<c:listContents height="10" width="480">
<componentElement>
<reportElement x="0" y="0" width="480" height="10" uuid="11b0a744-efc7-4f10-918e-0a33b43dd39a"/>
<c:list printOrder="Horizontal">
<datasetRun subDataset="dataset3" uuid="daed3010-252b-451d-a65b-764732f310e0">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{matrix})]]></dataSourceExpression>
</datasetRun>
<c:listContents height="10" width="30">
<textField>
<reportElement x="0" y="0" width="30" height="10" uuid="fb2c61a5-3972-43af-b286-a328d07cc64f"/>
<box leftPadding="10">
<pen lineColor="#000000"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement>
<font fontName="Times New Roman" size="7" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField>
</c:listContents>
</c:list>
</componentElement>
</c:listContents>
</c:list>
</componentElement>
<componentElement>
<reportElement x="172" y="20" width="128" height="10" uuid="b3cff54a-20b6-4f4d-8ac2-fe824379ff0c"/>
<datasetRun subDataset="dataset4" uuid="323513d5-9d93-4d95-932b-61127305f920">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subCategoryList})]]></dataSourceExpression>
</datasetRun>
<c:listContents height="10" width="128">
<componentElement>
<reportElement x="0" y="0" width="128" height="10" uuid="11b0a744-efc7-4f10-918e-0a33b43dd39a"/>
<c:list printOrder="Vertical">
<datasetRun subDataset="dataset5" uuid="daed3010-252b-451d-a65b-764732f310e0">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subCatMatrix})]]></dataSourceExpression>
</datasetRun>
<c:listContents height="10" width="128">
<textField>
<reportElement x="0" y="0" width="128" height="10" uuid="fb2c61a5-3972-43af-b286-a328d07cc64f"/>
<box>
<pen lineColor="#000000"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center">
<font fontName="Times New Roman" size="7" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{subCategory}]]></textFieldExpression>
</textField>
</c:listContents>
</c:list>
</componentElement>
</c:listContents>
</c:list>
</componentElement>
<componentElement>
<reportElement key="table" style="table" x="26" y="20" width="146" height="350" uuid="2977d74f-5689-47a3-945f-d1e4cab1398e"/>
<datasetRun subDataset="dataset6" uuid="8a8ce504-0cdc-4c6f-b84e-924c4eb3c007">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{categoryList})]]></dataSourceExpression>
</datasetRun>
<jr:column width="146" uuid="9240765d-6493-4e6b-985d-5e52c18a45f8">
<jr:detailCell style="table_TD" height="10">
<staticText>
<reportElement x="0" y="0" width="146" height="10" uuid="d4545fa4-8a8f-493a-b8ad-310013296bcf"/>
<box>
<pen lineColor="#000000"/>
<leftPen lineWidth="0.5"/>
</box>
<textElement>
<font fontName="Times New Roman" size="7" isBold="true" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[]]></text>
</staticText>
<textField pattern=" ">
<reportElement x="0" y="0" width="146" height="10" uuid="f0be3905-d3eb-4a20-8199-d848888f770f">
<printWhenExpression><![CDATA[$V{categoryGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<box>
<pen lineColor="#000000"/>
<topPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center">
<font fontName="Times New Roman" size="7" isBold="true" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{category}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>-
</band>
</summary>
</jasperReport>
 
 
charu.chandni28's picture
Joined: Jul 21 2015 - 11:07pm
Last seen: 4 years 2 months ago

0 Answers:

No answers yet
Feedback