You need to HTML-Encode the contents of the memo field and then you need to replace carriage return and line feed characters with <BR> tags:
Response.Write(STRTRAN(STRTRAN(STRTRAN(Server.HTMLEncode(memo), CHR(13) + CHR(10), '<BR>', CHR(13), '<BR>', CHR(10), '<BR>')
Note that the above code first replaces CRLF combinations and then handles individual CR and LF characters. This avoids double <BR> tags being added for CRLF combinations, which normally display as a single line break.
FoxWeb Support Team
support@foxweb.com
Sent by John Waite on 01/31/2002 07:47:53 AM:
Dear Forum,
I cannot find a way to get notes made in a Foxpro memo to display correctly in HTML with line breaks as in the original.
Example:
-------------------------------------------------------------------------------------------------
In the Foxpro memo field:
-------------------------------------------------------------------------------------------------
Bestellung 13.5.88. Rückantw. 11/88. Rückantw. 1/89. Rückantw. 3/89 (Anfr.). Rückantw. 10/90. St.Lt Rf rec. & Req.lists sent SP & Lt. JW 05.96
St.lt.lists sent 05.97 VS
E-mail reply to SLC 29.6.97; thanks have rec'd lists. VS
-------------------------------------------------------------------------------------------------
This will display fine in a <TEXTAREA> within a form, but if I wish to display it as simple output e.g.
<TABLE ALIGN="center" WIDTH="592" CELLSPACING="0" CELLPADDING="2" BORDER="0"><TR>
<TD BGCOLOR="#F5F5F5"><%=memofield%></TD>
</TR></TABLE>
The breaks are ignored and I get:
-------------------------------------------------------------------------------------------------
Bestellung 13.5.88. Rückantw. 11/88. Rückantw. 1/89. Rückantw. 3/89 (Anfr.). Rückantw. 10/90. St.Lt Rf rec. & Req.lists sent SP & Lt. JW 05.96. St.lt.lists sent 05.97 VSE-mail reply to SLC 29.6.97; thanks have rec'd lists. VS
-------------------------------------------------------------------------------------------------
If I use <PRE>, e.g.
<TABLE ALIGN="center" WIDTH="592" CELLSPACING="0" CELLPADDING="2" BORDER="0"><TR>
<TD BGCOLOR="#F5F5F5"><PRE><%=memofield%></PRE></TD>
</TR></TABLE>
the lines shoot off for miles to the right and I am unable to get them to wrap.
Well, I hope you understand!
Any help much appreciated.
Best wishes to all forum users.
John