Jasper reports 避免重复表中的列标题

Jasper reports 避免重复表中的列标题,jasper-reports,Jasper Reports,我是JasperReports的新手。当我尝试向列中的表添加值时,列的页眉和页脚会重复出现。如何对列标题进行分组 我的jrxml: 试试这个,它会对你有用的 <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan

我是JasperReports的新手。当我尝试向列中的表添加值时,列的页眉和页脚会重复出现。如何对列标题进行分组

我的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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="551344a1-61b0-419c-92a0-5ebe6f8d4219">
<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="1.0" lineColor="#000000"/>
    </box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 1">
    <box>
        <pen lineWidth="1.0" lineColor="#000000"/>
    </box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 2">
    <box>
        <pen lineWidth="1.0" lineColor="#000000"/>
    </box>
</style>
<style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<subDataset name="Table Dataset 1" uuid="75c6059a-1e76-45b2-a87c-14792e68956e">
    <field name="training" class="java.lang.String"/>
    <field name="trainingPeriod" class="java.lang.String"/>
    <field name="traingingAdd" class="java.lang.String"/>
    <field name="noofgovtorderauth" class="java.lang.String"/>
    <field name="authapprovingentry" class="java.lang.String"/>
    <field name="deptTestpassed" class="java.lang.String"/>
    <field name="athConducTest" class="java.lang.String"/>
    <field name="monthSptestPassed" class="java.lang.String"/>
    <field name="yrSpTestPassed" class="java.lang.String"/>
    <field name="regNo" class="java.lang.String"/>
</subDataset>
<parameter name="ReportName" class="java.lang.String"/>
<parameter name="Date" class="java.lang.String"/>
<parameter name="Title" class="java.lang.String"/>
<parameter name="SubTitle" class="java.lang.String"/>
<parameter name="FooterDetail" class="java.lang.String"/>
<parameter name="govtlogo" class="java.lang.String"/>
<parameter name="TNWRDLogo" class="java.lang.String"/>
<field name="training" class="java.lang.String">
    <fieldDescription><![CDATA[training]]></fieldDescription>
</field>
<field name="trainingPeriod" class="java.lang.String"/>
<field name="traingingAdd" class="java.lang.String"/>
<field name="noofgovtorderauth" class="java.lang.String"/>
<field name="authapprovingentry" class="java.lang.String"/>
<field name="deptTestpassed" class="java.lang.String"/>
<field name="athConducTest" class="java.lang.String"/>
<field name="monthSptestPassed" class="java.lang.String"/>
<field name="yrSpTestPassed" class="java.lang.String"/>
<field name="regNo" class="java.lang.String"/>
<background>
    <band splitType="Stretch"/>
</background>
<title>
    <band height="114" splitType="Stretch">
        <frame>
            <reportElement uuid="fd5eaed7-88e8-4980-8205-6e50cf99ef20" x="0" y="27" width="565" height="52">
                <property name="net.sf.jasperreports.export.pdf.tag.h1"/>
                <property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
                <property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>
                <property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
            </reportElement>
            <box>
                <pen lineWidth="0.25"/>
                <topPen lineWidth="0.25"/>
                <leftPen lineWidth="0.25"/>
                <bottomPen lineWidth="0.25"/>
                <rightPen lineWidth="0.25"/>
            </box>
            <textField>
                <reportElement uuid="d3615141-0461-4665-b5f4-46a10f968d0e" x="174" y="33" width="213" height="19"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{SubTitle}]]></textFieldExpression>
            </textField>
            <image>
                <reportElement uuid="34b5159e-3eb2-450a-9536-f79813589d48" x="442" y="2" width="61" height="48"/>
                <imageExpression><![CDATA[$P{TNWRDLogo}]]></imageExpression>
            </image>
            <image>
                <reportElement uuid="cd0f7d86-105f-44a1-8c27-81feacfba469" x="65" y="0" width="98" height="51"/>
                <imageExpression><![CDATA[$P{govtlogo}]]></imageExpression>
            </image>
            <textField>
                <reportElement uuid="e8aee322-2336-4637-9a5c-cb51af5995c8" x="174" y="0" width="213" height="32"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
            </textField>
        </frame>
    </band>
</title>
<pageHeader>
    <band height="35" splitType="Stretch">
        <textField>
            <reportElement uuid="4c89127c-2b66-447e-af83-7ffd210e8a19" x="174" y="5" width="213" height="24"/>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font size="9" isBold="true"/>
            </textElement>
            <textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
        </textField>
        <frame>
            <reportElement uuid="4ba70858-74c9-48a0-9690-888636570607" x="0" y="0" width="565" height="35"/>
            <box>
                <pen lineWidth="0.25"/>
                <topPen lineWidth="0.25"/>
                <leftPen lineWidth="0.25"/>
                <bottomPen lineWidth="0.25"/>
                <rightPen lineWidth="0.25"/>
            </box>
        </frame>
    </band>
</pageHeader>
<columnHeader>
    <band height="23" splitType="Stretch">
        <printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
        <staticText>
            <reportElement uuid="479cad61-a5be-4318-8e81-850ba6626e59" x="27" y="0" width="100" height="22">
                <printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
            </reportElement>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <text><![CDATA[Training Detail]]></text>
        </staticText>
        <staticText>
            <reportElement uuid="d3474389-b724-4579-81b6-2f5c806aaa25" x="432" y="0" width="100" height="22">
                <printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
            </reportElement>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <text><![CDATA[Special Tests Passed]]></text>
        </staticText>
    </band>
</columnHeader>
<detail>
    <band height="125" splitType="Stretch">
        <componentElement>
            <reportElement uuid="f2abf631-2415-4ba1-bf93-4b1d458dacbc" key="table 2" style="table 2" x="53" y="44" width="450" height="50"/>
            <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="Table Dataset 1" uuid="69dfdbc6-34fc-48ee-8ecd-197cde9b11fb">
                    <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
                </datasetRun>
                <jr:columnGroup uuid="7287994d-bc5c-4286-8607-29969a2eb9ef" width="450">
                    <jr:column uuid="dbd24c78-fb82-47c4-9342-d5a73fb7e000" width="90">
                        <jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
                            <staticText>
                                <reportElement uuid="74b27263-d281-4136-b674-12bd3a74bd3c" x="0" y="0" width="90" height="29"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Training]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 2_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement uuid="be34b5c1-5cd4-43e3-b6f9-0e6f2bbf88db" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{training}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="01a9c90b-46c3-4693-b186-7abc77256f73" width="90">
                        <jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
                            <staticText>
                                <reportElement uuid="5ada3627-2084-4d79-a923-b6acbeee8058" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Period / Duration]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 2_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement uuid="abb64036-38ea-4560-84fd-09dde730c3bc" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{trainingPeriod}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="0865e4a3-5dbe-430a-9c50-90a636ef49ef" width="90">
                        <jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
                            <staticText>
                                <reportElement uuid="a897110e-f09f-43f3-a53b-aa8450065832" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Impart Training Address]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 2_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement uuid="41f45483-1f6d-480c-a59c-96093111ace5" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{traingingAdd}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="8949efe8-7041-49dd-8631-685e8568e6d5" width="90">
                        <jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
                            <staticText>
                                <reportElement uuid="643bb124-0b66-448d-ade8-c7b540f18eb5" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[No of Government Orders]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 2_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement uuid="834227d7-673a-4335-b1f8-37b3892125b1" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{noofgovtorderauth}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="7fa15b45-3110-4648-ab41-35fc77c625d6" width="90">
                        <jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
                            <staticText>
                                <reportElement uuid="cfd20c24-75f4-449e-83ae-38d9e0507728" x="0" y="0" width="90" height="29"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[ Approving Audthority]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 2_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement uuid="b5e5dec0-46d3-47b5-aefe-5fe2038c94b9" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{authapprovingentry}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:columnGroup>
            </jr:table>
        </componentElement>
    </band>
</detail>
<columnFooter>
    <band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
    <band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
    <band height="42" splitType="Stretch"/>
</summary>
</jasperReport>