Status/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): M Bean / M Bean (M Bean)
Created: 12/02/2014
Components: Reporting
Versions: 10.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: Final /
Priority/Frequency: Normal / Some users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 1
Problem Description:
Various problems exist. Firstly, sometimes HTML gets spit out as code instead of being rendered. Second, even when it is rendered, links go to places that don't make sense.
Steps to Reproduce:
Place any of the following into the contents of a field in CF Report Builder:
Case 1: To learn more about the class you registered for, go to <a href="http://www.byu.edu">our home page</a>.
Case 2: To learn more about the class you registered for, go to <em>our home page</em> at http://www.byu.edu.
Case 3: To learn more about the class you registered for, go to <hr>our home page at http://www.byu.edu.
Case 4: To learn more about the class you registered for, go to <a href="http://www.byu.edu">our home page</a>.
To learn more about the class you registered for, go to <a href="http://www.byu.edu">our home page</a>
Actual Result:
Case 1: End up as code instead of as rendered HTML. (Non-breaking space entity is not supported, but others such as <, > are supported.)
Case 1: End up as code instead of as rendered HTML. (<em> is not supported)
Case 3: End up as code instead of as rendered HTML. (<hr> is not supported)
Case 4: Renders and looks fine, but when the link is clicked, the link user is redirected to "our home page" instead of to where the href specifies that it should go.
Expected Result:
Case 1: End up as rendered HTML.
Case 1: End up as rendered HTML.
Case 3: End up as rendered HTML.
Case 4: End up as rendered HTML with a link that goes to the location specified by href.
Any Workarounds:
I added a function to our report, using regular expressions:
<cfargument name="html" required="true" type="string" />
<!---History:
CF reports are generated using CF Report Builder, but Adobe reader is what reads the PDFs.
HTML is automatically supported by the report builder/adobe reader, but only if no non-supported
HTML tags are used.
The following tags don't have to be converted:
<\/?strong>
<br ?\/?>
<a href="http://someLink.com">http://someLink.com</a>
The following tags do have to be converted/removed
TinyMCE-produced underlined text using spans with styles
(and probably other entities, but this is the only one we know of)
em
<a href="http://someLink.com">here</a>
--->
<cfset local.convertedHTML = arguments.html />
<!---Remove <hr> --->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, "<hr ?\/?>", "", "ALL") />
<!---Replace <em> --->
<cfset local.convertedHTML = Replace(local.convertedHTML, "em>", "i>", "ALL") />
<!---Replace underlined with nothing (NOT supported in CF reports) --->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, "<\/?span[^>]*>", "", "ALL") />
<!---Replace HTML entities with space --->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, " ", " ", "ALL") />
<!---Start HTML Anchor tag regex rewrites--->
<!---Remove target="_blank" (it will be put back on purpose later to keep the second rewrite from affecting already-rewritten links) --->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, " target=""_blank""", "", "ALL") />
<!---HTML Rewrite 1:
Make the link fully transparent (strangely, CF reports use presence of an href attribute to make links appear blue, but use anchor's child text as the text):
<a href="http://someLink.com" target="_blank">someLink.com</a> --> <a href="http://someLink.com" target="_blank">http://someLink.com</a>--->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, "<a href=""([^""]*)""[^>]*>[a-zA-Z\d:\/]+\.[^<]*?</a>", "<a href=""\1"" target=""_blank"">\1</a>", "ALL") />
<!---HTML Rewrite 2:
<a href="http://someLink.com">here</a> --> here (<a href="http://someLink.com">http://someLink.com</a>)
--->
<cfset local.convertedHTML = ReReplace(local.convertedHTML, "<a href=""([^""]*)"">([^.]+?)</a>", "\2 (<a href=""\1"">\1</a>)", "ALL") />
<!---End tag rewrites --->
<cfreturn local.convertedHTML />
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3861021
External Customer Info:
External Company:
External Customer Name: bean5b
External Customer Email:
External Test Config: My Hardware and Environment details:
CF 10. Tried various updates and they all seemed to have the issue.
Attachments:
Comments: