All Forums >> [Scripting] >> ASP >> vbcrlf ? why isn't this working? Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I am using asp and vbscript. I would like to put a carriage return and line feed in a string of text. This code still generates all of the text on one line. I don't understand why. I have also tried substituting the vbcrlf for chr(10) & chr(13), but I still have the string output on one line. ???? It seems like a simple problem, but I must be missing something.
Any help would be appreciated. Thanks!
Code:
<% Response.Write("My name is Jane. ") & vbCRLF Response.Write("It is May 9th.") & vbCRLF & vbCRLF & vbCRLF Response.Write("Have a great day!") %>
Thank you both for your comments. I am actually trying to create a string in VBScript which will be passed to make a pdf. So, I am not using any HTML, just VBScript and the pdf maker. But, even when I try this code as the only code in my asp page, I still get it all on one line:
<%@LANGUAGE="VBSCRIPT" %>
<% Response.Write("My name is Jane. " & vbCRLF) Response.Write("It is May 9th." & vbCRLF & vbCRLF & vbCRLF) Response.Write("Have a great day!") %>
Posts: 12
Score: 0
Joined: 4/25/2005
From: France
Status: offline
Dear ES,
As Firas rightly posted, the vbCRLF does not work in this case, it does not render on an html page. I don't know what your PDF converter accepts incoming, but if it accepts html, then you need to replace the vbCRLF by <BR> tags. If it accepts straight "notepad" text, then you should not be writing this to the response object, but you should probably be building a text string to pass to the pdf like:
sPDFString="My name is Jane. " & vbCRLF sPDFString=sPDFString & "It is May 9th." & vbCRLF & vbCRLF & vbCRLF sPDFString=sPDFString & "Have a great day!"
and something like
rc=CreatePDFfromString(sPDFString)
or create a textfile from your string which you can pass to your converter. good luck, and let us know if this helps,
Thank you for your help. It seems then that the pdf (I am using the Freeware fpdf.asp) software must not support crlf. I have tried to build a string as you suggested, but it is always in one line. I will try to figure out a work around.