Forum Moderators: open

Message Too Old, No Replies

End of line

Formatting a .txt file

         

woop01

1:02 am on Jan 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to format some .txt files to display properly in an ASP page. We can open the file as and turn it into a string but when we do a response.write it removes the paragraph returns.

Is there a way to read the character returns so that the page is properly formatted?

Easy_Coder

1:38 am on Jan 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you tried vbCrlf or chr(10)?

emsaw

2:17 am on Jan 14, 2006 (gmt 0)

10+ Year Member



woop01,

as Easy_Coder started to suggest, you need to do something with your carriage return - line feeds.

Your text file contains Carriage Return - Line Feeds(CrLf s).

When you get the contents of your file, simply do a:
myFile = Replace(myFile, vbCrLf, "<br>")

This will replace all of the appropriate line feeds in the document with HTML breaks so that it will display properly in your web browser.

Now you should be able to Response.Write your file contents as you were expecting.

HTH,

Mark

woop01

4:22 am on Jan 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great, worked like a charm.

Thanks for the help.