<a> html tag used for hyperlink doesn't work in Jasper Report

夙愿已清 提交于 2019-12-18 08:57:40

问题


I want to make one word of a sentence as a hyperlink. I have written it as : Click on our <a href="http://www.google.co.in"> website </a> to know the details. The markup property of the text field is also selected as "html". But the hyperlink is not created. Please help.


回答1:


The HTML markups are only intended for the purpose of styling a text field. You are looking for the "Hyperlink" option. It doesn't work for static text fields though, but when you right click on a text field you should find the item "Hyperlink" in the context menu. This allows you to link the field to an anchor, another report or a webpage.




回答2:


Hyperlinks are not supported by static text fields - they only work with text field.. it worked when i used a text field and as the expression entered static text in quotes "click here etc" Then add a hyperlink by selecting hyperlink from the context menu..




回答3:


I know the question is pretty old, but if somebody need a code, I will add it here:

<textField>
    <reportElement positionType="Float" x="220" y="45" width="406" height="60"/>
    <textElement markup="html">
        <font fontName="Arial" size="8"/>
    </textElement>
    <textFieldExpression><![CDATA["Click on our"+"<u><font color='blue'><a href='http://www.google.co.in'>website</a></font></u>"]]> 
    </textFieldExpression>
</textField>



回答4:


The htm markup seems to be extremely limited. I have only found that it works for very basic html formating such as <i> and <b> tags. I do not think anchors or lists or any 'fancier' markup with do anything.



来源:https://stackoverflow.com/questions/2818439/a-html-tag-used-for-hyperlink-doesnt-work-in-jasper-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!