2010-07-14 90 views

回答

2

1)首先在服务器上创建一个.doc文件。然后创建一个文件系统对象,并用它来打开.doc文件,并写入到它:

Set file = CreateObject("Scripting.FileSystemObject") 
Set wordFile = file.CreateTextFile(pathToYourDocFile, true) 
wordFile.WriteLine(htmlOutput) 
wordFile.close 

“htmlOutput”必须包含要导出到Word的页面。

2)另一种选择是直接与Word实例上班mentioned on MSDN

Set wordApp = GetObject(, "Word.Application") 
wordApp.Visible = False 
wordApp.Documents.Open pathToYourDocFile 
Set wordApp = Nothing 

您将需要以内容写入文件挖through the Word API

3)改变页面的内容塔伊会自动打开它在Word(如果安装在客户端上):

Response.ContentType = "application/msword"