Skip navigation
Currently Being Moderated

XHTML formatting does not work

Apr 15, 2009 3:52 PM

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.

 
Replies
  • Currently Being Moderated
    Jun 12, 2009 12:58 PM   in reply to Superfly-FR

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2009 3:01 PM   in reply to Superfly-FR

    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>

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 5, 2009 12:11 PM   in reply to Superfly-FR

    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; ,&amp;,&lt;,&gt;,&laquo; , &raquo;,&oelig;u,&OElig;,...,&oelig;,&euro;,',&AElig;,&Aacute;,&Acirc ;,&Agrave; ,&Aring;,&Atilde;,&Auml;,&Ccedil;,&ETH;,&Eacute;,&Ecirc;,&Egrave;,&Eu ml;,&Iacute ;,&Icirc;,&Igrave;,&Iuml;,&Ntilde;,&Oacute;,&Ocirc;,&Ograve;,&Oslash; ,&Otilde;,& Ouml;,&THORN;,&Uacute;,&Ucirc;,&Ugrave;,&Uuml;,&Yacute;,&aacute;,&aci rc;,&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;,&yacu te;,&yuml;, &iexcl;,&pound;,&curren;,&yen;,&brvbar;,&sect;,&uml;,&copy;,&ordf;,&l aquo;,&not; ,&shy;,&reg;,&macr;,&deg;,&plusmn;,&sup2;,&sup3;,&acute;,&micro;,&par a;,&middot; ,&cedil;,&sup1;,&ordm;,&raquo;,&frac14;,&frac12;,&frac34;,&iquest;,&t imes;,&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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 12, 2010 9:42 AM   in reply to armyCoder

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

     

    Regards

    Sharon

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2012 12:25 AM   in reply to Superfly-FR

    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 :)

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points