Formatting plain text with CR to HTML

Results 1 to 4 of 4

Thread: Formatting plain text with CR to HTML

  1. #1
    ICornish Guest

    Default Formatting plain text with CR to HTML

    Hi all,<BR>I have a database field which contains a lot of "formatted" text, typically about 30-60K.<BR>My ASP script currently reads this, and dumps it out unceremoniously into unformatted text, losing the layout.<BR>Is there anyway I can "replace" the CR&#039s & tabs in the text with the appropriate HTML. I&#039ve tried using the REPLACE function, but this only seems to work with "short" strings.<BR><BR>Suggestions appreciated.<BR><BR>Ian

  2. #2
    Volker Guest

    Default RE: Formatting plain text with CR to HTML

    try the HTML tag <BR>&#060;pre&#062;your formatted text here&#060;/pre&#062;<BR>so, when you just write your text from the database within these tags, it should work!

  3. #3
    ICornish Guest

    Default RE: Formatting plain text with CR to HTML

    That would mean training my users how to write HTML!

  4. #4
    Volker Guest

    Default No, it doesnt....

    it doesnt mean, that your users have to learn html.<BR>I think your issue is to put plain formatted text (with some tabs and spaces and carriage returns) into a html page, right?<BR>So, in your asp code you could have something like that:<BR>&#060;%<BR>myText = getTextFromDatabase()<BR>Response.Write "&#060;pre&#062;" & myText & "&#060;/pre&#062;"<BR>%&#062;<BR>So, myText contains just pure text WITHOUT any htmls tags!!!<BR>The &#060;pre&#062;-tag is talking care of displaying the text like it is.<BR>I hope, this helps!<BR><BR>regards <BR>volker


Posting Permissions

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