I'm using the example shown at :
http://support.microsoft.com:80/supp.../q276/4/88.asp
It involves using ASP/VbScript and ADODB.Stream to read binary data from a
*.DOC or *.RTF
file and then send it to the user with Response.ContentType and BinaryWrite.
Everything works fine until I try to Replace() certain strings in the *.RTF
file with my own
data. I'm assuming Replace() is choking on the binary characters, or
incorrectly thinking 0x00 values are
marking end of string.
Is there some kind of ReplaceB() function that I can use instead of lines
#10 and #11?
1> Set fs = Server.CreateObject("ADODB.Stream") ' Since FileSystemObject
can't read binary data
2>
3> fs.Type = 1 ' adTypeBinary=1
4> fs.Open
5> fs.LoadFromFile fNameFull
6> fullDoc = fs.Read
7> fs.Close
8> Set fs = Nothing
9>
10> fullDoc = Replace(fullDoc, "%g_name%", "Joe Smith")
11> fullDoc = Replace(fullDoc, "%g_date%", "12-31-2004")
12>
13> Response.Buffer = vbTrue
14> Response.ContentType = "application/msword" ' or "application/rtf"
15> Response.BinaryWrite fullDoc
16> Response.Flush