School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,138 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,814 people online right now. Registration is fast and FREE... Join Now!




Using HTML in CFReport Builder data

 

Using HTML in CFReport Builder data, HTML data passed into CFReport Builder needs HTML tags stripped

xheartonfire43x

6 Oct, 2009 - 06:58 AM
Post #1

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 267



Thanked: 2 times
My Contributions
Good Morning everyone,
I am using a PDF format of CFReport Builder to build invoicing reports for an application we use with our clients to track support tickets. The description of both the support issue and work done on the application are in Rich Text format so they have HTML tags around them. CFReport Builder apparently doesn't like HTML tags, because it shows the HTML tags. Is there a way to have report builder actually format the data by the tags?

User is offlineProfile CardPM
+Quote Post


Craig328

RE: Using HTML In CFReport Builder Data

14 Oct, 2009 - 12:24 PM
Post #2

New D.I.C Head
*

Joined: 13 Jan, 2008
Posts: 23



Thanked: 3 times
My Contributions
Beats me but there are scripts out there you can set up as functions to strip all the HTML elements out of a string. Try looking at cflib.org for such. Strip the strings before you send them to the report builder and you should be on your way.

QUOTE(xheartonfire43x @ 6 Oct, 2009 - 06:58 AM) *

Good Morning everyone,
I am using a PDF format of CFReport Builder to build invoicing reports for an application we use with our clients to track support tickets. The description of both the support issue and work done on the application are in Rich Text format so they have HTML tags around them. CFReport Builder apparently doesn't like HTML tags, because it shows the HTML tags. Is there a way to have report builder actually format the data by the tags?


User is offlineProfile CardPM
+Quote Post

xheartonfire43x

RE: Using HTML In CFReport Builder Data

18 Oct, 2009 - 08:22 AM
Post #3

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 267



Thanked: 2 times
My Contributions
QUOTE(Craig328 @ 14 Oct, 2009 - 12:24 PM) *

Beats me but there are scripts out there you can set up as functions to strip all the HTML elements out of a string. Try looking at cflib.org for such. Strip the strings before you send them to the report builder and you should be on your way.


That is how I have it working right now, but the problem is that this project is for sending out invoices to our clients.
So a nice work description that look like:

Work Done:
  • Fixed Joe's software issue
  • Fixed DreamInCode website error
  • Repaired John's hardware issue


Now looks like this:

Work Done:Fixed Joe's software issueFixed DreamInCode website errorRepaired John's hardware issue.

You can see which a client would rather see, especially if they have to delegate where the funds come from for paying my company.
User is offlineProfile CardPM
+Quote Post

armyCoder

RE: Using HTML In CFReport Builder Data

5 Nov, 2009 - 08:56 AM
Post #4

D.I.C Head
**

Joined: 2 Feb, 2009
Posts: 54



Thanked: 1 times
My Contributions
Ever have any luck with this? I'm going nuts trying to put html into my cfreport.
User is offlineProfile CardPM
+Quote Post

xheartonfire43x

RE: Using HTML In CFReport Builder Data

5 Nov, 2009 - 09:13 AM
Post #5

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 267



Thanked: 2 times
My Contributions
QUOTE(armyCoder @ 5 Nov, 2009 - 08:56 AM) *

Ever have any luck with this? I'm going nuts trying to put html into my cfreport.


No I didn't. You would think Adobe would have thought of this and released something.
User is offlineProfile CardPM
+Quote Post

armyCoder

RE: Using HTML In CFReport Builder Data

5 Nov, 2009 - 12:05 PM
Post #6

D.I.C Head
**

Joined: 2 Feb, 2009
Posts: 54



Thanked: 1 times
My Contributions
Ok, I think I got a fix here.

Since the report builder automatically kills its attempt at rendering the HTML once it encounters a foreign tag, we create a function so that it will do it's best to convert what it can, and clean the rest out so the output can have a chance at displaying properly.

First, create a report function by going to Report-->Report functions.

Name your new function dummyHTML.

Paste the below into the function, save it.
CODE



<cfargument name="source" required="yes">
<cfset char_ASCII="  ,&,<,>,« , »,oeu,Œ,…,œ,€,’,Æ,Á,Â,À,Å,Ã,Ä,Ç,Ð,É,Ê,È,Ë,Í,Î,Ì,Ï,Ñ,Ó,Ô,Ò,Ø,Õ,Ö,Þ,Ú,Û,Ù,Ü,Ý,á,â ,æ,à,å,ã,ä,ç,é,ê,è,ð,ë,í,î,ì,ï,ñ,ó,ô,ò,ø,õ,ö,ß,þ,ú,û,ù,ü,ý,ÿ,¡,£,¤,¥,¦,§,¨,©,ª,«
,¬,­,®,¯,°,±,²,³,´,µ,¶,·,¸,¹,º,»,¼,½,¾,¿,×,÷,¢,•">

<!---EDIT: MAKE SURE TO put the nbsp back together, it wouldnt display right in the forum!--->

<cfset char_HTML="& nbsp;,&amp;,&lt;,&gt;,&laquo; , &raquo;,&oelig;u,&OElig;,...,&oelig;,&euro;,',&AElig;,&Aacute;,&Acirc;,&Agrave; ,&Aring;,&Atilde;,&Auml;,&Ccedil;,&ETH;,&Eacute;,&Ecirc;,&Egrave;,&Euml;,&Iacute;,&Icirc;,&Igrave;,&Iuml;,&Ntilde;,&Oacute;,&Ocirc;,&Ograve;,&Oslash;,&Otilde;,& Ouml;,&THORN;,&Uacute;,&Ucirc;,&Ugrave;,&Uuml;,&Yacute;,&aacute;,&acirc;,&aelig; ,&agrave;,&aring;,&atilde;,&auml;,&ccedil;,&eacute;,&ecirc;,&egrave;,&eth;,&euml;,&iacute;,&icirc;,&igrave;,&iuml;,&ntilde;,&oacute;,&ocirc;,&ograve;,&oslash;,& otilde;,&ouml;,&szlig;,&thorn;,&uacute;,&ucirc;,&ugrave;,&uuml;,&yacute;,&yuml;, &iexcl;,&pound;,&curren;,&yen;,&brvbar;,&sect;,&uml;,&copy;,&ordf;,&laquo;,&not; ,&shy;,&reg;,&macr;,&deg;,&plusmn;,&sup2;,&sup3;,&acute;,&micro;,&para;,&middot; ,&cedil;,&sup1;,&ordm;,&raquo;,&frac14;,&frac12;,&frac34;,&iquest;,&times;,&divi de;,&cent;,&##8226;">

<cfset clean = '#ReplaceList(source,char_HTML,char_ASCII)#'>
<cfset clean = '#ReReplaceNoCase(clean,"<[^>]*>","","ALL")#'>
<cfset clean = '#ReReplaceNoCase(clean,"&.*;","","ALL")#'>
<cfreturn clean>



So this takes any results that have extra...funky tags and strips them out. This worked well for me because it counts the tags I need it to see and wipes out the funky ones...including any other &.....; tags that aren't included in the function.

Now create a new field, right click it, make sure the XHTML formatted text option is checked.

In the expression builder type:

CODE

report.dummyHTML(string)


Where string is whatever you want to output. You may need 'query.string' depending on how you're getting your results.

See this forum on Adobe to see how this function started...Antoine actually started the idea, and I added on some more pieces that finished it well for me.

http://forums.adobe.com/message/2371167#2371167

you can add more HTML codes to the function...get them from the link below:

http://www.ascii.cl/htmlcodes.htm (make sure to use ## where needed)

Hope this helps!

This post has been edited by armyCoder: 5 Nov, 2009 - 12:08 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 03:14PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month