Nicholas Paldino,
Here is my code:
Dim x, OutputFilePath, outString, strDelimeter, atmp
strDelimeter = ReadText
OutputFilePath = Day(Date) & Month(Date) & Year(Date) & Hour(Time) &
Minute(Time) & Second(Time) & Int(Rnd*99) + 1
atmp = "<% codepage = 1200 " & strDelimeter
outString = atmp
outString = outString & "<% Response.Charset = ""UTF-8"" " &
strDelimeter & vbCrlf
outString = outString & "<% Response.ContentType =
""application/vnd.ms-excel"" " & vbCrlf
outString = outString & "Response.AddHeader ""Content-Disposition"",
""inline; " & ""
outString = outString & "filename=" & OutputFilePath & ".xls"" " &
vbCrlf
OutputFilePath = OutputFilePath & ".asp"
WriteTofile outString, OutputFilePath
WriteTofile strDelimeter, OutputFilePath
'Retrieving data from oracle process
Response.Write("<script language=""javascript"">")
Response.Write("window.open('Reports/" & OutputFilePath & "');")
Response.Write("</script>")
Public Function WriteToFile(Contents, FileName)
On Error Resume Next
Dim arrFile
arrFile = split(FileName, ".")
FileName = arrFile(0) & "." & arrFile(1)
FilePath = Server.MapPath(FileName)
If arrFile(1) = "htm" Then
Dim tempPath, objStream
tempPath = Mid(FilePath, 1, (Len(FilePath)-Len(FileName)))
FilePath = tempPath & "Reports\" & FileName
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(FilePath, 8, True)
oTextFile.Write Contents
oTextFile.Writeline ""
oTextFile.Close
'ExcelFile FilePath, FileName
Else
Dim tmpPath, objFile2
tmpPath = Mid(FilePath, 1, (Len(FilePath)-Len(FileName)))
FilePath = tmpPath & "Logs\" & FileName
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(FilePath, 8, True)
oTextFile.Write Contents
oTextFile.Writeline ""
oTextFile.Close
End If
Set oTextFile = Nothing
Set oFS = Nothing
End Function
Here is one of the example asp code generated:
<% Response.Charset = "UTF-8" %>
<% Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "inline;filename=test.xls"
%>
<html><head><title>Report</title></head><body>
<table cellspacing=0 border="1" width="100%">
<tr height='30'><td bgcolor='YELLOW'> S Survey Id</td></tr>
<tr>
<td bgcolor='#fffff8' border="0" width="100%"> (e-mail address removed)</td>
</tr>
<tr>
<td bgcolor='#fffff8' border="0" width="100%"> 123145312</td>
</tr>
<tr>
<td bgcolor='#fffff8' border="0" width="100%">
上门æœåŠ¡æ˜¯æ²¡ä»€ä¹ˆå¯æŒ‘å‰”çš„ï¼Œåªæ˜¯ç”µè„‘在出厂时还是è¦
å†ä¸¥æ ¼æŠŠå…³ä¸€ä¸‹ï¼Œå…å¾—åŒæ–¹éƒ½æµªè´¹å®è´µæ—¶é—´ã€‚上次我们
的那å°ç”µè„‘刚打开就ä¸èƒ½è¿è¡Œï¼ŒåŽæ®ç»´ä¿®äººå‘˜è®²ä¸»æ¿ã€
显示器都有问题,除æ¤ä»¥å¤–,里é¢çš„æ“ä½œç³»ç»Ÿæ ¹æœ¬å°±æ²¡
è£…ï¼Œè¿žåˆ†åŒºéƒ½æ²¡æ ¼å¼åŒ–ã€‚åŽæ¥è¿™ä¸€ç³»åˆ—都是维修人员装
好的。 </td>
</tr>
<tr>
<td bgcolor='#fffff8' border="0" width="100%">
基本上æ¥è¯´åœ¨æ‰€æœ‰çš„网上ä¿ä¿®ï¼Œæˆ‘对dell是最满æ„的。ä½
†æœ‰çš„æ—¶å€™å¦‚æžœä¸åœ¨è´¨ä¿æœŸå†…dell的收费有些高。</td>
</tr>
<tr>
<td bgcolor='#fffff8' border="0" width="100%">
对政府行业应该éšå«éšåˆ°ï¼Œè¿™æ ·æœ‰åˆ©äºŽåœ¨æ”¿åºœé‡‡è´ä¸å–
得更大的生æ„。</td>
</tr>
</table></body></html>