如何在 Jaspersoft Studio 中创建三级目录?

How to Create a Three Level Table of Contents in Jaspersoft Studio?

提问人:life_thinker 提问时间:9/12/2023 最后编辑:Alex Klife_thinker 更新时间:11/5/2023 访问量:11

问:

我创建了:

- 主要报告(章节)

-- 附子报告(部分)

---还有另一个小节的地方。

不幸的是,当我将主报告添加到报告簿时,它没有出现,我不知道如何为部分和小节创建书签以在目录中显示为 lvl 2 和 3。

XML 数据源:

<data>
    <chapter>
        <title>Chapter 1</title>
        <section>
            <title>Section 1.1</title>
            <subsection>
                <title>Subsection 1.1.1</title>
            </subsection>
            <subsection>
                <title>Subsection 1.1.2</title>
            </subsection>
        </section>
        <section>
            <title>Section 1.2</title>
            <subsection>
                <title>Subsection 1.2.1</title>
            </subsection>
        </section>
    </chapter>
    <chapter>
        <title>Chapter 2</title>
        <section>
            <title>Section 2.1</title>
            <subsection>
                <title>Subsection 2.1.1</title>
                <subsection>
                    <title>Subsection 2.1.1.1</title>
                </subsection>
            </subsection>
            <subsection>
                <title>Subsection 2.1.2</title>
            </subsection>
        </section>
        <section>
            <title>Section 2.2</title>
        </section>
    </chapter>
</data>

主要报告:

<!-- Created with Jaspersoft Studio version 6.20.5.final using JasperReports Library version 6.20.5-3efcf2e67f959db3888d79f73dde2dbd7acb4f8e  -->
<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="listThree" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d6b4833b-32f2-472a-86f2-b3ddb97df3ee">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="chatXML"/>
    <queryString language="xPath">
        <![CDATA[data/chapter]]>
    </queryString>
    <field name="chapterTitle" class="java.lang.String">
        <property name="net.sf.jasperreports.xpath.field.expression" value="title"/>
        <fieldDescription><![CDATA[chapterTitle]]></fieldDescription>
    </field>
    <group name="chapterGroup" isStartNewPage="true">
        <groupExpression><![CDATA[$F{chapterTitle}]]></groupExpression>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <detail>
        <band height="30">
            <textField bookmarkLevel="1">
                <reportElement x="0" y="0" width="100" height="30" isPrintWhenDetailOverflows="true" uuid="e779eb11-4c9c-4fbb-99bc-c4f3eb0a355c"/>
                <textFieldExpression><![CDATA[$F{chapterTitle}]]></textFieldExpression>
                <anchorNameExpression><![CDATA[$F{chapterTitle}]]></anchorNameExpression>
            </textField>
        </band>
        <band height="61">
            <subreport overflowType="Stretch">
                <reportElement x="20" y="0" width="535" height="60" uuid="e04dca3e-96e0-4e82-8621-725b9f71b6c5">
                    <property name="com.jaspersoft.studio.element.name" value="section"/>
                </reportElement>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("chapter/section")]]></dataSourceExpression>
                <subreportExpression><![CDATA["sectionSubreport.jasper"]]></subreportExpression>
            </subreport>
            <break>
                <reportElement x="0" y="60" width="98" height="1" uuid="41451c94-0a60-46a6-b95e-8b7dce6145eb"/>
            </break>
        </band>
    </detail>
</jasperReport>

当我在一个简单的桌子上测试报告簿时,它看起来没有错误,但是嵌套 3 度已经存在问题。我使用摘要书模板,我没有提供任何新内容。请使用目录中的书签和级别帮助解决此问题。

Jasper-报告 嵌套列表 目录

评论


答: 暂无答案