tracker issue : CF-3861021

select a category, or use search below
(searches all categories and all time range)
Title:

Some HTML is not supported in by Report Builder/PDFs generated by CF

| View in Tracker

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 &nbsp;<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
		&nbsp; (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, "&nbsp;", " ", "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:

We're pretty sure HTML was better supported, but either Adobe Reader or the PDF generation has changed such that HTML is not as supported. It sends our HTML into HTML 1.0 days.
Comment by External U.
9812 | December 02, 2014 05:52:52 PM GMT
The only reason I was able to even discover that some HTML is supported is because someone else ran into it and gave a brief blurp at http://kay.smoljak.com/2006/04/coldfusion-report-builder-sanity-saving-tips/. It would be great if documentation would let us know what is supported... Some people have done work-arounds such as those described at http://www.dreamincode.net/forums/topic/130228-using-html-in-cfreport-builder-data/.
Comment by External U.
9813 | December 02, 2014 06:03:00 PM GMT
StackOverflow also shows that people have run into this: http://stackoverflow.com/questions/15407683/cf-report-builder-displaying-html-tags-ie-rich-text-as-plain-text
Comment by External U.
9814 | December 02, 2014 06:04:16 PM GMT
http://stackoverflow.com/questions/15407683/cf-report-builder-displaying-html-tags-ie-rich-text-as-plain-text
Vote by External U.
9816 | December 05, 2014 04:41:21 AM GMT
On cf report - We do not support rendering of HTML while html content being accessed from database, thanks.
Comment by Akhila K.
9815 | December 09, 2014 01:46:12 AM GMT