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> = <p> ) as soon as an unrecognized sequence (as á ) will be found. So the problem is identified ... not the solution yet.
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 : á will not work while &##225; will ('normal' ISO code is á)
Warning : you have to double#, if you don't, you'll get an error.
Bonus : the full table of ISO / HTML special caracters bellow.
Caracter | ISO code | HTML code |
---|---|---|
" | " | " |
& | & | & |
€ | € | € |
 |  | |
‚ | ‚ | |
ƒ | ƒ | |
„ | „ | |
… | … | |
† | † | |
‡ | ‡ | |
ˆ | ˆ | |
‰ | ‰ | |
Š | Š | |
‹ | ‹ | < |
Œ | Œ | |
 |  | |
Ž | Ž | |
 |  | |
 |  | |
‘ | ‘ | |
’ | ’ | |
“ | “ | |
” | ” | |
• | • | |
– | – | |
— | — | |
˜ | ˜ | |
™ | ™ | |
š | š | |
› | › | > |
œ | œ | œ |
 |  | |
ž | ž | |
Ÿ | Ÿ | Ÿ |
espace |   | |
¡ | ¡ | ¡ |
¢ | ¢ | ¢ |
£ | £ | £ |
¤ | ¤ | ¤ |
¥ | ¥ | ¥ |
¦ | ¦ | ¦ |
§ | § | § |
¨ | ¨ | ¨ |
© | © | © |
ª | ª | ª |
« | « | « |
¬ | ¬ | ¬ |
| ­ | ­ |
® | ® | ® |
¯ | ¯ | &masr; |
° | ° | ° |
± | ± | ± |
² | ² | ² |
³ | ³ | ³ |
´ | ´ | ´ |
µ | µ | µ |
¶ | ¶ | ¶ |
· | · | · |
¸ | ¸ | ¸ |
¹ | ¹ | ¹ |
º | º | º |
» | » | » |
¼ | ¼ | ¼ |
½ | ½ | ½ |
¾ | ¾ | ¾ |
¿ | ¿ | ¿ |
À | À | À |
Á | Á | Á |
 |  |  |
à | à | à |
Ä | Ä | Ä |
Å | Å | Å |
Æ | Æ | &Aelig |
Ç | Ç | Ç |
È | È | È |
É | É | É |
Ê | Ê | Ê |
Ë | Ë | Ë |
Ì | Ì | Ì |
Í | Í | Í |
Î | Î | Î |
Ï | Ï | Ï |
Ð | Ð | ð |
Ñ | Ñ | Ñ |
Ò | Ò | Ò |
Ó | Ó | Ó |
Ô | Ô | Ô |
Õ | Õ | Õ |
Ö | Ö | Ö |
× | × | × |
Ø | Ø | Ø |
Ù | Ù | Ù |
Ú | Ú | Ú |
Û | Û | Û |
Ü | Ü | Ü |
Ý | Ý | Ý |
Þ | Þ | þ |
ß | ß | ß |
à | à | à |
á | á | á |
â | â | â |
ã | ã | ã |
ä | ä | ä |
å | å | å |
æ | æ | æ |
ç | ç | ç |
è | è | è |
é | é | é |
ê | ê | ê |
ë | ë | ë |
ì | ì | ì |
í | í | í |
î | î | î |
ï | ï | ï |
ð | ð | ð |
ñ | ñ | ñ |
ò | ò | ò |
ó | ó | ó |
ô | ô | ô |
õ | õ | õ |
ö | ö | ö |
÷ | ÷ | ÷ |
ø | ø | ø |
ù | ù | ù |
ú | ú | ú |
û | û | û |
ü | ü | ü |
ý | ý | ý |
þ | þ | þ |
ÿ | ÿ | ÿ |
Now, all "we" have to do is putting all of this together and find the good solution ...
Any help welcomed !
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=" ,&,« , »,œu,Œ,...,œ,€,',Æ,Á,Â,À,Å,Ã,Ä,Ç,Ð,É,Ê,È,Ë,Í,Î,Ì,Ï,Ñ,Ó,Ô,Ò,Ø,Õ,Ö,Þ,Ú,Û,Ù,Ü,Ý,á,â,æ,à,å,ã,ä,ç,é,ê,è,ð,ë,í,î,ì,ï,ñ,ó,ô,ò,ø,õ,ö,ß,þ,ú,û,ù,ü,ý,ÿ,¡,£,¤,¥,¦,§,¨,©,ª,«,¬,­,®,¯,°,±,²,³,´,µ,¶,·,¸,¹,º,»,¼,½,¾,¿,×,÷,¢">
<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.
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?
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.
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>
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; ,&,<,>,« , »,œu,Œ,...,œ,€,',Æ,Á,Â,À ,Å,Ã,Ä,Ç,Ð,É,Ê,È,Ë,Í ;,Î,Ì,Ï,Ñ,Ó,Ô,Ò,Ø,Õ,& Ouml;,Þ,Ú,Û,Ù,Ü,Ý,á,â,æ ,à,å,ã,ä,ç,é,ê,è,ð,ë ;,í,î,ì,ï,ñ,ó,ô,ò,ø,& otilde;,ö,ß,þ,ú,û,ù,ü,ý,ÿ, ¡,£,¤,¥,¦,§,¨,©,ª,«,¬ ,­,®,¯,°,±,²,³,´,µ,¶,· ,¸,¹,º,»,¼,½,¾,¿,×,&divi de;,¢">
<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.
Copy link to clipboard
Copied
Absolutely Brilliant .. you have saved a ton of time of mine .. Hats off to you!
Regards
Sharon
Copy link to clipboard
Copied
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