Jump to content

Multi-line hyperlinks leave a gap between the lines


marion.baumgartner

Recommended Posts

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>[/code]

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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})[/code]

 

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)[/code]

 

I hope this is helpful.

 

Link to comment
Share on other sites

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...