2024年3月30日发(作者:)

以下为从库中取资料并生成Wrod代码(已经测试,成功):

<%

Sub CreateWord(filename,content)

Dim fso, MyFile

'创建FSO对象,有些服务器有可能不支持这个对象,那就没戏了

Set fso = CreateObject("stemObject")

'生成新文件文件放在当前目录的word/下,当前测试时必须有这个目录

Set MyFile = TextFile(filename, True)

ine(content)

'关闭文件

Set fso = Nothing

End Sub

'假设数据库中有如下字段:

'FileName:生成的word文件名

'content:个人资料

让word文档以附件的形式打开的代码

<%Dim strFilePathConst

adTypeBinary = 1

strFilePath = "word/"

Set objStream = Object("")

= adTypeBinary

omFile h(strFilePath) 'change the path if

necessary

tType = "application/octet-stream"

der "Content-Disposition", "attachment; filename=数据采集