Multi-line hyperlinks leave a gap between the lines

When I add a hyperlink that stretches over multiple lines this leaves a gap of a couple of pixels between the lines where the link is not clickable.

Is there a way to avoid this gap so that the link is continuously clickable over the lines it stretches?

Thansk for any idea or help of how to avoid this.

 

Below is the code I am using to add the hyperlink (f${URL} is defined as a string filed <field name="URL" class="java.lang.String"/> and is passed in from the main report. :

 

            <textField textAdjust="StretchHeight" isBlankWhenNull="true" hyperlinkType="Reference">
                <reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="0" width="300" height="9" isPrintWhenDetailOverflows="true" forecolor="#4C8FBA" uuid="010fa648-c53e-4fa5-82ab-ce9a63ed9bd5">
                    <property name="local_mesure_unity" value="pixel"/>
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[!($F{URL}.equals("") || $F{URL} == null)]]></printWhenExpression>
                </reportElement>
                <box topPadding="0" bottomPadding="3"/>
                <textElement verticalAlignment="Top">
                    <font fontName="Cadastra" size="6"/>
                    <paragraph leftIndent="8" spacingBefore="0" spacingAfter="2"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{URL}]]></textFieldExpression>
                <hyperlinkReferenceExpression><![CDATA[$F{URL}]]></hyperlinkReferenceExpression>
                <hyperlinkTooltipExpression><![CDATA[$F{URL}]]></hyperlinkTooltipExpression>
            </textField>

marion.baumgartner's picture
Joined: Aug 24 2015 - 8:02am
Last seen: 1 year 9 months ago

1 Answer:

This may not be a very good method, but it is an idea.
How about filling in the blanks after the URL so that the link is continuously clickable on the line where the link extends?

 

ex1.

Adds a blank character to the right side of the string up to a maximum of 100 digits.

String.format("%-100s", $F{url})

ex2.

Add a blank character to the right side of the string up to a maximum of 100 digits, then cut at 100 digits to align the length.

(String.format("%-100s", $F{url})).substring(0,100)

I hope this is helpful.

yama818's picture
6763
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 month 4 weeks ago
Feedback
randomness