报告中的多个列表组件

时间:2016-12-27 10:38:01

标签: jasper-reports

我在项目中使用了多个List组件来检索包含列表对象的多个列的数据。现在我从所有列表组件中获取数据,但不能同步获取行。如下图所示。

如图所示我无法获得行同步,尽管所有列都具有相同数量的数据(20):

我在此报告中使用了总共​​7个列表组件。这是我的报告设计。

这是我的报告设计:

现在,这是我在下面的ireport的XML代码。

<?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="Patient_User_Audit_Trail_Test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9fda934e-ab17-4f3c-b918-18be64af34f8">
    <style name="Title" fontName="Arial" fontSize="26" isBold="true"/>
    <style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
    <style name="Detail" fontName="Arial" fontSize="12"/>
    <subDataset name="dataset2" uuid="bbe5eee2-9a7c-4841-8509-a25b5ea29a1f">
        <field name="auditTrailDate" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset1" uuid="180b1e56-06b5-41ac-8a2c-f6c0ca0f15b1">
        <field name="entityName" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset3" uuid="16ce9d70-a57d-40c4-8927-6b3e72aab804">
        <field name="moduleName" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset4" uuid="bcfad895-054f-4682-a592-14d987c8a847">
        <field name="action" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset5" uuid="3a04ea3c-39ce-4372-8c23-7e92ae47a5f7">
        <field name="user" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset6" uuid="3728de41-9b60-407c-a1b6-32cb0d4cc274">
        <field name="version" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <subDataset name="dataset7" uuid="51f1da76-232a-4cc9-9bb2-b4788e3d1e32">
        <field name="ipAddress" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <field name="auditTrailDate" class="java.util.Date"/>
    <field name="entityName" class="java.lang.String"/>
    <field name="moduleName" class="java.lang.String"/>
    <field name="user" class="java.lang.String"/>
    <field name="action" class="java.lang.String"/>
    <field name="version" class="java.lang.String"/>
    <field name="ipAddress" class="java.lang.String"/>
    <field name="patientUserAuditTrailList" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList1" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList2" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList3" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList4" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList5" class="java.util.Collection"/>
    <field name="patientUserAuditTrailList6" class="java.util.Collection"/>
    <title>
        <band height="70" splitType="Stretch">
            <staticText>
                <reportElement style="Title" stretchType="RelativeToTallestObject" x="0" y="8" width="263" height="33" isPrintWhenDetailOverflows="true" uuid="39345e12-619f-46a0-8350-84cd8dee7539">
                    <property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
                </reportElement>
                <textElement verticalAlignment="Middle" markup="html"/>
                <text><![CDATA[Omscer Audit Report]]></text>
            </staticText>
            <staticText>
                <reportElement style="SubTitle" x="2" y="46" width="204" height="22" uuid="2ab3ba89-41a1-474f-927f-fc7e626606a7">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement>
                    <font size="16"/>
                </textElement>
                <text><![CDATA[Patient & User Audit Trail]]></text>
            </staticText>
            <image hAlign="Center" vAlign="Middle" onErrorType="Blank">
                <reportElement x="280" y="0" width="275" height="64" uuid="0873284e-25a3-4f37-9975-a0513745458b"/>
                <imageExpression><![CDATA["logo_oscer.png"]]></imageExpression>
            </image>
        </band>
    </title>
    <columnHeader>
        <band height="36" splitType="Stretch">
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="0" y="17" width="79" height="19" uuid="9123f0ea-98d0-49b8-aa2e-d2116c0732a8">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[Date]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="79" y="17" width="90" height="19" uuid="b4e4a2cc-bbc1-4aac-9c37-2f121961ab91">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[Entity]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="169" y="17" width="84" height="19" uuid="a6e8545a-972f-4f0f-b5eb-f19b688209e9">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[Module]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="254" y="17" width="118" height="19" uuid="5313bb2a-28ed-441a-b61d-9ed970a915a8"/>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[Action]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="372" y="17" width="62" height="19" uuid="9486a1d0-d31b-4f39-aa41-66f96a4c19dd">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[User]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="434" y="17" width="34" height="19" uuid="50a81b3d-328d-4c60-a518-bc53ce7705bd"/>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[Ver. ]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" stretchType="RelativeToBandHeight" x="468" y="17" width="87" height="19" uuid="02c4bfc5-72cd-45ac-b8f3-a857c9c21a37">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <box padding="3" leftPadding="5">
                    <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                    <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#999999"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <text><![CDATA[IP Address]]></text>
            </staticText>
            <line>
                <reportElement positionType="FixRelativeToBottom" x="2" y="35" width="555" height="1" uuid="50fd04da-0661-4a41-a96f-e9cd70bcf437"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
        </band>
    </columnHeader>
    <detail>
        <band height="22" splitType="Stretch">
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="254" y="2" width="118" height="18" uuid="d2ca701a-97d6-4401-91ae-d1e03825b04d"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset4" uuid="bf7c80a4-e6d4-4244-a2f8-e00e361e2ea7">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList3})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="18" width="118">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="118" height="18" isPrintWhenDetailOverflows="true" uuid="d562331b-04e7-4736-a4e5-5eb19b8eb371"/>
                            <textFieldExpression><![CDATA[$F{action}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <componentElement>
                <reportElement key="" style="Detail" stretchType="RelativeToBandHeight" x="0" y="1" width="79" height="18" uuid="819f572f-4075-41bd-bcd6-2e8145d8bdf1"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset2" uuid="3f1af63e-4772-465c-9608-44ac842a86f1">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="18" width="79">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="79" height="18" isPrintWhenDetailOverflows="true" uuid="df1da492-1324-4a3f-9a70-03359daa2545"/>
                            <textFieldExpression><![CDATA[$F{auditTrailDate}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="79" y="1" width="90" height="18" uuid="f0c08800-6047-452e-8b27-d5bfcb21591c"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset1" uuid="26399034-8222-4fdf-af85-06e2adffed77">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList1})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="18" width="90">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="89" height="18" isPrintWhenDetailOverflows="true" uuid="2bae45b7-6cb6-4c82-91ec-71f1c5045042"/>
                            <textFieldExpression><![CDATA[$F{entityName}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <line>
                <reportElement positionType="Float" x="0" y="19" width="555" height="1" isPrintWhenDetailOverflows="true" uuid="0d23f704-a75d-4777-b2d3-109a55a9d6ab"/>
            </line>
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="169" y="1" width="85" height="19" uuid="a92bc530-bcea-4e45-838f-d80b744ec8a5"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset3" uuid="ff0cde48-0c59-4446-a23b-aad4ed204faf">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList2})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="19" width="85">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="85" height="19" isPrintWhenDetailOverflows="true" uuid="730c836d-9447-4c5f-bec8-636054405039"/>
                            <textFieldExpression><![CDATA[$F{moduleName}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="372" y="0" width="62" height="20" uuid="3522afde-1e54-452b-8ad1-cb3184e608fe"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset5" uuid="233d6b96-83a9-48e5-bf87-807a06e88e75">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList4})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="20" width="62">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="62" height="20" isPrintWhenDetailOverflows="true" uuid="522ad468-3b38-435f-ae9c-81158c8c321b"/>
                            <textFieldExpression><![CDATA[$F{user}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="434" y="0" width="34" height="20" uuid="3f9477b7-af9c-43ee-9228-6cf02d3a130d"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset6" uuid="0034cf3d-8a1c-4226-94b8-02d34ad7e0d7">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList5})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="20" width="34">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="34" height="20" isPrintWhenDetailOverflows="true" uuid="81144da8-9533-431d-a8e9-026bac80a72e"/>
                            <textFieldExpression><![CDATA[$F{version}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <componentElement>
                <reportElement stretchType="RelativeToBandHeight" x="468" y="1" width="87" height="19" uuid="28c5ced0-12b8-4b99-8a9c-b43454f17e2e"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset7" uuid="e4e989c0-f06f-404e-bac2-682d1e7c1708">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{patientUserAuditTrailList6})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="19" width="87">
                        <textField isStretchWithOverflow="true">
                            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="87" height="19" isPrintWhenDetailOverflows="true" uuid="c721e0b9-bdd3-4773-9eb9-54f652c33d99"/>
                            <textFieldExpression><![CDATA[$F{ipAddress}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
        </band>
    </detail>
    <columnFooter>
        <band height="22" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="20" splitType="Stretch">
            <textField pattern="EEEEE dd MMMMM yyyy">
                <reportElement style="Column header" x="0" y="0" width="197" height="20" uuid="a145139c-cb3e-477f-8168-82c059a99b1e"/>
                <textElement>
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24))]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement style="Column header" x="512" y="0" width="40" height="20" uuid="631b8ab3-e976-4b83-be6c-51094461ff98"/>
                <textElement>
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Column header" x="432" y="0" width="80" height="20" uuid="3b7df66c-9e19-47ac-921b-785d96d680ed"/>
                <textElement textAlignment="Right">
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>

我的主要目的是让这些数据同步,但我不知道如何使用多个列表组件分隔每一行。

我的问题是如何让这些列表组件行同步?

如果有人不明白这个问题,请问我。

0 个答案:

没有答案