Jump to content
Changes to the Jaspersoft community edition download ×

Leader (e.g. in a TOC)


jan.cirpka

Recommended Posts

I like to beautify the Table of Contents which I created based on the sample given. In particular I would like the leaders - the (dotted) line up to the page number on the right - to fit the remaining(!) length of the line. Such features are for example available in the out of the box TOC templates of Microsoft Word. And to make things even more complex, ideally also handling multi-line scenarios (due to stretching). As you see in the included example I got to some point. VBut the dots are overlapping the text ... kind of obvious as I did place overlapping textFields. Is there a better way? And secondly tyou see in the last row with the very long text that the formatting is almost correct ... but why are the dots in the middle?

toc-example.png.539469d6b5c3bdaddb95b7d46343a23a.png

Of course, with the output goes some .jrmxl code so that you all can see what I've done:

 

<detail>    <band height="15" splitType="Stretch">        <printWhenExpression><![CDATA[$F{level} == 1]]></printWhenExpression>        <textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">            <reportElement style="Bold" x="40" y="0" width="460" height="15" isRemoveLineWhenBlank="true"/>            <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>            <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>        </textField>        <staticText>            <reportElement style="Bold" positionType="FixRelativeToBottom" stretchType="ContainerBottom" x="150" y="0" width="375" height="15" isRemoveLineWhenBlank="true" />            <textElement textAlignment="Right"/>            <text><![CDATA[________________________________________________________________________________]]></text>        </staticText>        <textField isStretchWithOverflow="true" evaluationTime="Auto" hyperlinkType="LocalAnchor">            <reportElement positionType="FixRelativeToBottom" stretchType="ContainerBottom" x="525" y="0" width="30" height="15" isRemoveLineWhenBlank="true" />            <textElement textAlignment="Right"/>            <textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 1]]></textFieldExpression>            <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>        </textField>    </band>    <band height="15" splitType="Stretch">        <printWhenExpression><![CDATA[$F{level} == 2]]></printWhenExpression>        <textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">            <reportElement positionType="Float" x="75" y="0" width="425" height="15" isRemoveLineWhenBlank="true"/>            <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>            <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>            <hyperlinkTooltipExpression><![CDATA[$F{label}]]></hyperlinkTooltipExpression>        </textField>        <staticText>            <reportElement positionType="FixRelativeToBottom" stretchType="ContainerBottom" x="150" y="0" width="375" height="15" isRemoveLineWhenBlank="true" uuid="c6cf49ba-d7d0-42fa-9b2c-36ba110e91f4"/>            <textElement textAlignment="Right" verticalAlignment="Top"/>            <text><![CDATA[.   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .]]></text>        </staticText>        <textField isStretchWithOverflow="true" evaluationTime="Auto" hyperlinkType="LocalAnchor">            <reportElement positionType="FixRelativeToBottom" stretchType="ContainerBottom" x="525" y="0" width="30" height="15" isRemoveLineWhenBlank="true" "/>            <textElement textAlignment="Right"/>            <textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 1]]></textFieldExpression>            <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>        </textField>    </band></detail>[/code]

Any help would be greatly appreciated.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...