2010-07-14 168 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"