• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XHTML formatting does not work

Explorer ,
Apr 15, 2009 Apr 15, 2009

Copy link to clipboard

Copied

XHTML formatting text parameter for query fields does not seems to work (MS SQL ntext containing fckeditor HTML text).

- My DB is MS SQL, code page FRENCH (may be the issue ?), tested both nvarchar(max) and text field types.

- I've tried both direct cfr invocation and cfreport (+ styling techniques: external Css or "cfset inline CSS" ).

- I've set the XHTML Text Format for the field within the report builder

Anyone had the same problem or any similar issue ?

Thanks in advance.

Edit, 4 hours later ...

I found the problem (by inserting different combinations of HTML instructions in the DB string).
While a trivial <p>toto</p><i>titi</i> will work, the whole string will be escaped (<p> = &lt;p&gt; ) as soon as an unrecognized sequence (as &aacute; ) will be found. So the problem is identified ... not the solution yet.

TOPICS
Reporting

Views

9.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 16, 2009 Apr 16, 2009

Copy link to clipboard

Copied

Some basic html text formatting (not exclusive, but those worked).

There's a sample you can test :

'<p>Bellow is a paragraph<br /><em>Line 1 Italic</em><br /><strong>    Line2 strong</strong><br /></p><ul><li>ul1</li><li>ul2</li><li>ul3<br /></li></ul>

<ol><li>ol1</li><li>ol2</li><li>ol3</li></ol><font color="red">this text is red</font><br /><font size="+2">this text is big</font>'

Warnings :

- Be aware that any carriage return in the string will be converted as a <br>

- Notice the 4 blanks before "Line2"; they will be reproduced 'as is' in the field while HTML would ignore 3 redondant one's.

- Use simple quotes (') to identify the string sequence, not double quotes (").

Special caracters

Looks like cfr are not able to use the HTML codes for special caracters.

If there is any of those in your string, the FULL string will be converted to "textonly".

You have to use ISO coding instead ...

For example : &aacute; will not work while &##225; will ('normal' ISO code is &#225;)

Warning : you have to double#, if you don't, you'll get an error.

Bonus : the full table of ISO / HTML special caracters bellow.

CaracterISO code HTML code
"&#34;&quot;
&&#38;&
&#128;&euro;
&#129;&#129;
&#130;
ƒ&#131;
&#132;
&#133;
&#134;
&#135;
ˆ&#136;
&#137;
Š&#138;
&#139;&lt;
Œ&#140;
&#141;&#141;
Ž&#142;
&#143;&#143;
&#144;&#144;
&#145;
&#146;
&#147;
&#148;
&#149;
&#150;
&#151;
˜&#152;
&#153;
š&#154;
&#155;&gt;
œ&#156;&oelig;
&#157;&#157;
ž&#158;
Ÿ&#159;&Yuml;
espace&#160;
¡&#161;&iexcl;
¢&#162;&cent;
£&#163;&pound;
¤&#164;&curren;
¥&#165;&yen
¦&#166;&brvbar;
§&#167;&sect;
¨&#168;&uml;
©&#169;&copy; 
ª&#170;&ordf;
«&#171;&laquo;
¬&#172;&not;
­&#173;&shy;
®&#174;&reg;
¯&#175;&masr;
°&#176;&deg;
±&#177;&plusmn;
²&#178;&sup2;
³&#179;&sup3;
´&#180;&acute;
µ&#181;&micro;
&#182;&para;
·&#183;&middot;
¸&#184;&cedil;
¹&#185;&sup1;
º&#186;&ordm;
»&#187;&raquo;
¼&#188;&frac14;
½&#189;&frac12;
¾&#190;&frac34;
¿&#191;&iquest;
À&#192;&Agrave;
Á&#193;&Aacute;
Â&#194;&Acirc;
Ã&#195;&Atilde;
Ä&#196;&Auml;
Å&#197;&Aring;
Æ&#198&Aelig
Ç&#199;&Ccedil;
È&#200;&Egrave;
É&#201;&Eacute;
Ê&#202;&Ecirc;
Ë&#203;&Euml;
Ì&#204;&Igrave;
Í&#205;&Iacute;
Î&#206;&Icirc;
Ï&#207;&Iuml;
Ð&#208;&eth;
Ñ&#209;&Ntilde;
Ò&#210;&Ograve;
Ó&#211;&Oacute;
Ô&#212;&Ocirc;
Õ&#213;&Otilde;
Ö&#214;&Ouml;
×&#215;&times;
Ø&#216;&Oslash;
Ù&#217;&Ugrave;
Ú&#218;&Uacute;
Û&#219;&Ucirc;
Ü&#220;&Uuml;
Ý&#221;&Yacute;
Þ&#222;&thorn;
ß&#223;&szlig;
à&#224;&agrave;
á&#225;&aacute;
â&#226;&acirc;
ã&#227;&atilde;
ä&#228;&auml;
å&#229;&aring;
æ&#230;&aelig;
ç&#231;&ccedil;
è&#232;&egrave;
é&#233;&eacute;
ê&#234;&ecirc;
ë&#235;&euml;
ì&#236;&igrave;
í&#237;&iacute;
î&#238;&icirc;
ï&#239;&iuml;
ð&#240;&eth;
ñ&#241;&ntilde;
ò&#242;&ograve;
ó&#243;&oacute;
ô&#244;&ocirc;
õ&#245;&otilde;
ö&#246;&ouml;
÷&#247;&divide;
ø&#248;&oslash;
ù&#249;&ugrave;
ú&#250;&uacute;
û&#251;&ucirc;
ü&#252;&uuml;
ý&#253;&yacute;
þ&#254;&thorn;
ÿ&#255;&yuml;


Now, all "we" have to do is putting all of this together and find the good solution ...

Any help welcomed !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 16, 2009 Apr 16, 2009

Copy link to clipboard

Copied

Well, let's say that I found an unelegant way. I do post it here, for those that want to digg or find a "dirty workaround".

If anyone @ Adobe could see this, maybe it could give ideas of what could or could not do report builder in CF9 (it is supposed to be much more powerfull, I mean more compliant with ireport/jasperreport, that seems to be the "off the hood" engine).

Step 1 : get rid of special caracters.

To do so, i used a rapport builder function.

The goal is to replace HTML special caracters with ASCII caracters (not ISO, more painfull to code and unusefull in my case while the site is mono-lingual). Nothing very tricky here.

The function is named "dummyHTML" here is the code :

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

<cfset char_HTML=" ,&,&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;,&divide;,&cent;">


<cfset texte1 = '#ReplaceList(source,char_HTML,char_ASCII)#'>

<cfreturn texte1>

Step 2 : finaly, user styling is not appropriate in this report, take it off !
I know ... seems crazy to remove what I seemed want to display first. But in fact, the HTML here is not usefull in a report context.

Nothing very tricky there too ... thanks to google.

We are about to suppress any HTML tag, just in a snap :

replace :

<cfset texte1 = '#ReplaceList(source,char_HTML,char_ASCII)#'>

<cfreturn texte1>

with :

<cfset texte1 = '#ReplaceList(source,char_HTML,char_ASCII)#'>

<cfset texte2 = '#REReplaceNoCase(texte1,"<[^>]*>","","ALL")#'>
<cfreturn texte2>

We can now use this expression in a report field :

report.dummyHTML(query.theTextIWant)

Et voilà ...

Hope it helps some of you.

Cheers

A.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2009 Jun 12, 2009

Copy link to clipboard

Copied

Antoine, Good post. I'm doing a cfform that uses cftextarea richtext="yes", like is being used in this forum, storing that in SQL Server and pulling it to a cfreport using the XHTML Text Formatting attribute. I see what you are saying and even used the function you posted above to get me further along. My users need to be able to add a page break, but of course the code for that causes the conversion to break. I hate to have to convert every character, especially since I don't know what a user might add, (e.g., an image) and not sure if that would work fully anyway. We must be missing something here. Has anyone found a solution or workaround related to passing html code to Report Builder? CF has a few html manipulation functions and I played with trying some combinations, but no luck. I wonder if it is being addressed in CF9. Passing html code to Report Builders seems like a basic issue. Adobe?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2009 Jun 12, 2009

Copy link to clipboard

Copied

Brian,

I'll keep on the dummy way.

In rich text,

line feed are "<br>" (or maybe "<br /> depending of which rich text editor you use).

and

carriage return (paragraph) are "<p> ... </p>".

What i'll do is the following :

1. replace "<p>" with "<br><br>" to simulate paragraphs feeds

2. Convert "<br>" into a special sequence as "¤B_R¤"

3. run the report function to remove any other HTML formatting tag

4. Replace back "¤B_R¤" with "<br> (sequence to add to the function)

Hope it helps, not sure I understood the "page break" term (froggy camembert here !)

Regards,

A.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2009 Jun 12, 2009

Copy link to clipboard

Copied

No, not a line break, a page break for which the rich text editor generates the following code:

<div style="page-break-after: always"><span style="display: none"> </span></div>

Also the following tags work fine as long as there are no attributes

<div><span> <span></div><p>test test</p>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 05, 2009 Nov 05, 2009

Copy link to clipboard

Copied

Hoping I can add something to this discussion. This is an issue that should not require 5 hours of banging my head against the wall. CF Report Builder should natively support dumping HTML into a field....but it only works if the supported tags are included, as has been mentioned.

Since the report builder automatically kills its attempt at rendering the HTML once it encouters a foreign tag, we need to amend this 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.

So, to build on Antoine's function...I added just a few more items to the ASCII and HTML lists:

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

<!---PUT THE NBSP back together, it wouldn't display properly on the forum--->

<cfset char_HTML="& nbsp; ,&,&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;">


<cfset clean = '#ReplaceList(source,char_HTML,char_ASCII)#'>

<cfreturn clean>

Note the nbsp, lt, and gt tags that weren't included. Once I added those, some of my results actually started to render. Imagine my excitement! But then, came disappointment once again and I realized that some still weren't working properly. Then I realized...some of the tags weren't supported and it was throwing the whole thing off. So...I added a line to the end of the function. BTW, I renamed his variable to 'clean'

<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 tas 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 include in the function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 12, 2010 May 12, 2010

Copy link to clipboard

Copied

Absolutely Brilliant .. you have saved a ton of time of mine .. Hats off to you!

Regards

Sharon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2012 Mar 19, 2012

Copy link to clipboard

Copied

LATEST

This did not work.

Your solution works same as you just simply put: #ReReplace(string, "(<[^>]*>)", " ", "All")# In the expression builder.

My scenario is: From application I have key-in data that using WYSIWYG editor with various format like font color, background color, alignment, bold, italic, etc. And store to a column type CLOB (I am using Oracle DB).

Now I have to show this data on ColdFusion Report that using a CFR template in exactly format as it is. I have ticked the XHTML check box for the field property on ColdFusion Report Builder design for this report.

Anyone have any solution for this issue.

I see someone have the same issue here: http://forums.adobe....3057027#3057027

But never has any answer for it (even from Adobe support team).

Any answer, I am highly appreciate :)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation