我想在网页上添加一个按钮,当点击时,应复制整个网页到MS Word文档。这必须在ASP中完成。
发布于 2010-07-15 03:04:40
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"https://stackoverflow.com/questions/3244948
复制相似问题