Merge cell in table footer

Hello, I have a table where I want to merge some cells in the table footer

Here is my table before trying to merge cell 1 to 6 

Here is the table afrer grouping cells 1 to 6 : 

 

Does someone know why it is producing two lines ?

Regards

jeanclaude.twagiramungu's picture
Joined: Jan 16 2018 - 11:38am
Last seen: 2 months 1 week ago

I have a similar problem, I hope someone will answer here so I would not have to create another thread.

sophieersted - 7 months 4 days ago

1 Answer:

Set Height to 0 for the footer cells you don't want.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.0.final using JasperReports Library version 6.1.1  -->
<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="Blank_A4_Landscape_1" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d670a5fc-7f7c-4af6-91f1-4121b99da744">
    <style name="Table" isDefault="true">
        <box>
            <pen lineWidth="0.5"/>
        </box>
    </style>
    <style name="Table_CH" style="Table" mode="Opaque" backcolor="#BFE1FF"/>
    <subDataset name="Dataset1" uuid="d0afc712-a54d-4808-9c1e-6e0b584bfc7a">
        <field name="_THIS" class="java.lang.String"/>
    </subDataset>
    <title>
        <band height="118">
            <componentElement>
                <reportElement x="0" y="0" width="800" height="100" uuid="5b169c2d-2ddc-47f9-a8c2-75aa2967bd47"/>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="Dataset1" uuid="7d33a1b3-8fa6-4c55-9224-d6bcbbe8c83d">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource(java.util.Arrays.asList(new String[] { "A", "B", "C", "D" }))]]></dataSourceExpression>
                    </datasetRun>
                    <jr:columnGroup width="178" uuid="056c1cbb-44f4-4163-bcb4-ba7d1c4a39bd">
                        <property name="com.jaspersoft.studio.components.table.model.column.name" value="Columns [2]"/>
                        <jr:columnFooter style="Table_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="178" height="30" uuid="353e4ea5-3bb1-4981-a476-5c5dcc4e92be"/>
                                <textElement textAlignment="Center"/>
                                <text><![CDATA[Spanned Footer]]></text>
                            </staticText>
                        </jr:columnFooter>
                        <jr:column width="89" uuid="c8cd84ef-9a85-4618-832e-0df32c1e994a">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
                            <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                                <staticText>
                                    <reportElement x="0" y="0" width="89" height="30" uuid="9c6e198d-f50a-477c-a468-df31e74b4e50"/>
                                    <text><![CDATA[Foobar]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:columnFooter style="Table_CH" height="0" rowSpan="1">
                                <property name="com.jaspersoft.studio.unit.height" value="px"/>
                            </jr:columnFooter>
                            <jr:detailCell style="Table" height="30">
                                <textField>
                                    <reportElement x="0" y="0" width="89" height="30" uuid="775d75f0-ffdd-4bc6-aa68-fa6177c2cc83"/>
                                    <textFieldExpression><![CDATA[$F{_THIS}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="89" uuid="6dcea097-22ca-43a0-bcc7-c48cf6ea2ae7">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
                            <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                                <staticText>
                                    <reportElement x="0" y="0" width="89" height="30" uuid="a804c276-7841-455f-8503-e1966f751d2d"/>
                                    <text><![CDATA[bar]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:columnFooter style="Table_CH" height="0" rowSpan="1">
                                <property name="com.jaspersoft.studio.unit.height" value="px"/>
                            </jr:columnFooter>
                            <jr:detailCell style="Table" height="30">
                                <textField>
                                    <reportElement x="0" y="0" width="89" height="30" uuid="b93c246a-3a9b-4695-96d8-5eecbcbf9cde"/>
                                    <textFieldExpression><![CDATA["bar"]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                    </jr:columnGroup>
                    <jr:column width="89" uuid="04cd569d-42ca-46e3-a6b7-005b3b3900ba">
                        <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="89" height="30" uuid="6136ef01-5687-41e9-8973-441f674c51c5"/>
                                <text><![CDATA[bag]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30" rowSpan="2">
                            <staticText>
                                <reportElement x="0" y="0" width="89" height="30" uuid="62306c92-daf8-4ea4-9cfc-62381e243b39"/>
                                <text><![CDATA[bag ?]]></text>
                            </staticText>
                        </jr:columnFooter>
                        <jr:detailCell style="Table" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="89" height="30" uuid="feaae1d2-9505-4bf3-a856-ee6e3ea96764"/>
                                <textFieldExpression><![CDATA["bag"]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </title>
</jasperReport>

zellers's picture
697
Joined: Feb 12 2019 - 11:18am
Last seen: 2 months 3 weeks ago
Feedback