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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating Memo Field Output

Status
Not open for further replies.

varnix

Programmer
Joined
Jan 7, 2002
Messages
94
Location
US
I have an app that takes data from a textarea on a form and writes it to a memo field in an access db.

When I output the data with <pre></pre> around it all of my carriage returns appear just fine, but the text does not wrap properly. I've even tried it in a table and it just makes the table HUGE.

If I remove the <pre> it seems to wrap great! But, the CR's are gone!

Any suggestions?
 
The
Code:
<pre>
tag will honor your formatting exactly, meaning it won't insert line breaks where there aren't any. I suggest that you remove the
Code:
<pre>
tag altogether and use a Replace() to change the line breaks in the memo field into HTML
Code:
<br />
tags.
Code:
<cfquery name=&quot;qryMyMemo&quot; datasource=&quot;myDSN&quot;>
   SELECT  memofield
   FROM    myTable
   WHERE   rowID = '#rowID#'
</cfquery>

<cfoutput query=&quot;qryMyMemo&quot;>
   #Replace(qryMyMemo.memofield,Chr(10),&quot;<br />&quot;,&quot;ALL&quot;)#
</cfoutput>
 
You could also use the ParagraphFormat() function.
<cfoutput>
#ParagraphFormat(qryMyMemo.memofield)#
</cfoutput>
 
paragraphformat() along with htmleditformat() work great for keeping line breaks and showing <> &quot;&quot; charachters
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top