Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting output from SQL Server TEXT datatype

Status
Not open for further replies.

mikecon

IS-IT--Management
Jun 14, 2001
8
US
Can anyone describe methods for outputting data from a SQL Server TEXT field as it was entered? If I use

Code:
<TEXTAREA>#MyTextField#</TEXTAREA>

the text is displayed appropriately (i.e. with what appear to be CR/LFs). But if I simply

Code:
<cfoutput>#MyTextField#</cfoutput>

the line formatting is lost and I get one long, contiguous string. I tried

Code:
<cfoutput>#ParagraphFormat(MyTextField)#</cfoutput>

but that didn't work -- it just seemed to add an extra CR/LF at the end of the TEXT string. :-?

I don't want to use <TEXTAREA> because I'm looking for output-only for a printable report (in a table) and I need the entire text field displayed. (Is there a way to suppress the scroll bars and have the TEXTAREA shrink/grow to accomodate the entire text field? That would achieve the output I'm looking for)

Any ideas or experiences?

Thanx in advance!
 
Since the response posts were not exactly beating down my door, I tried a bunch of things and it boils down to this. Maybe I'll get a self-inflicted 'star' ;-) ...

As I now see clearly, HTML doesn't give a rat's behind about CR/LF -- it summarily ignores them.

That's where something like <pre> comes in (although that was not a good solution for me -- to restrictive in it's lack of 'formattability').

Soon after, it dawned on me to simply replace the CR/LFs with HTML like <br> or <p>:

#REReplace(MyTextField, CHR(13) & CHR(10), &quot;<br>&quot;, &quot;ALL&quot;)#

 
You should take a look at the ReplaceList function. You can replace any combination of characters (including hidden ones like carriage returns) with anything else. For instance, replace a carriage return with <br>.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top