Long Strings (with CR's) and formatting in HTM

Results 1 to 2 of 2

Thread: Long Strings (with CR's) and formatting in HTM

  1. #1
    Ian Cornish Guest

    Default Long Strings (with CR's) and formatting in HTM

    Hi,<BR><BR>I have a database which stores (amongst other crap) a lot of text in long boring text fields. Now, I need to get that out into a HTML page, and I have it working fine, except for the layout.<BR>I could put the text into the database using HTML, but that means training the operators how to write HTML (too much hassle), or I could write a function that would do it for me.<BR><BR>I&#039ve tried using &#060;PRE&#062;&#060;/PRE&#062;, but that does not wrap the lines around. <BR>Essentially, the text may(usually) have carriage returns, and tab<BR>characters, so I guess I need a function to reformat the text to replace the carriage returns and tabs with the appropriate HTML code. Does anyone have a function that does this already ?<BR><BR>Ian<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Long Strings (with CR's) and formatting in

    &#060;%<BR>&#039remove the spaces from the BR tag below<BR>Function FormatStr(String)<BR> on Error resume next<BR> String = Replace(String, CHR(13), "")<BR> String = Replace(String, CHR(10) & CHR(10), "&#060;/P&#062;&#060;P&#062;")<BR> String = Replace(String, CHR(10), "&#060; BR &#062;")<BR> FormatStr = String<BR>End Function<BR>%&#062;<BR>&#060;%=formatStr(rs.Fields ("memo_field"))%&#062;<BR><BR><BR>Hope this helps... Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts