Jasper reports 用虚线在Jaspersoft studio中创建TOC

Jasper reports 用虚线在Jaspersoft studio中创建TOC,jasper-reports,Jasper Reports,我试图在jasper studio 6.4.3中创建我的目录。它必须是一个带点的TOC,这意味着我需要用点填充标签文本字段和页码文本字段之间的空间。我当时的解决方案有两个问题 首先:根据字段中文本的长度,可以看到半个点 秒:拉伸后,我无法使点和页码字段与标签对齐。 点的解决方案是,在两个文本字段后面都有一个静态文本字段,并将文本字段设置为“背景”,以覆盖文本后面的点 如图所示,第6页需要对齐,点应与文本字段中的第二行对齐,字符g后的点被剪切。您几乎可以通过以下方式实现所需: 垂直对齐为所

我试图在jasper studio 6.4.3中创建我的目录。它必须是一个带点的TOC,这意味着我需要用点填充标签文本字段和页码文本字段之间的空间。我当时的解决方案有两个问题

首先:根据字段中文本的长度,可以看到半个点

秒:拉伸后,我无法使点和页码字段与标签对齐。 点的解决方案是,在两个文本字段后面都有一个静态文本字段,并将文本字段设置为“背景”,以覆盖文本后面的点



如图所示,第6页需要对齐,点应与文本字段中的第二行对齐,字符g后的点被剪切。

您几乎可以通过以下方式实现所需:

  • 垂直对齐
    为所有文本元素设置为
    底部
  • stretchType
    设置为
    ContainerBottom
    ,用于“点式”静态文本和“页面索引”文本字段元素
像这样:

<band height="39" splitType="Stretch">
<staticText>
    <reportElement stretchType="ContainerBottom" mode="Transparent" x="0" y="1" width="440" height="18" uuid="b08b479c-10a8-4d87-8507-4f32fd50004f"/>
    <textElement verticalAlignment="Bottom"/>
    <text><![CDATA[. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .]]></text>
</staticText>
<textField isStretchWithOverflow="true">
    <reportElement stretchType="ContainerBottom" x="396" y="1" width="45" height="18" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/>
    <textElement textAlignment="Right" verticalAlignment="Bottom" markup="styled"/>
    <textFieldExpression><![CDATA["<style backcolor='white'>"+($V{PAGE_NUMBER} + $F{pageIndex} + 3)+"</style>"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
    <reportElement mode="Transparent" x="0" y="3" width="396" height="16" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1">
        <property name="com.jaspersoft.studio.unit.height" value="px"/>
    </reportElement>
    <textElement textAlignment="Left" verticalAlignment="Bottom" markup="styled"/>
    <textFieldExpression><![CDATA["<style backcolor='white'>"+$F{label}+"</style>"]]></textFieldExpression>
    <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>

输出:

注:

  • 由于文本元素重叠,您可能仍然会遇到“剪切”点。我想不出有什么不同的方法
  • 我已经通过删除样式和调整元素的高度来调整代码,以正确对齐
<band height="39" splitType="Stretch">
<staticText>
    <reportElement stretchType="ContainerBottom" mode="Transparent" x="0" y="1" width="440" height="18" uuid="b08b479c-10a8-4d87-8507-4f32fd50004f"/>
    <textElement verticalAlignment="Bottom"/>
    <text><![CDATA[. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .]]></text>
</staticText>
<textField isStretchWithOverflow="true">
    <reportElement stretchType="ContainerBottom" x="396" y="1" width="45" height="18" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/>
    <textElement textAlignment="Right" verticalAlignment="Bottom" markup="styled"/>
    <textFieldExpression><![CDATA["<style backcolor='white'>"+($V{PAGE_NUMBER} + $F{pageIndex} + 3)+"</style>"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
    <reportElement mode="Transparent" x="0" y="3" width="396" height="16" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1">
        <property name="com.jaspersoft.studio.unit.height" value="px"/>
    </reportElement>
    <textElement textAlignment="Left" verticalAlignment="Bottom" markup="styled"/>
    <textFieldExpression><![CDATA["<style backcolor='white'>"+$F{label}+"</style>"]]></textFieldExpression>
    <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>