日期:2014-05-18  浏览次数:20512 次

如何用ASP.NET打开本地WORD文档
如何用ASP.NET打开本地已知地址WORD文档,只需要用WEORD打开它就可以

------解决方案--------------------
贴一端客户端使用js打开的,但是会弹出警告框,需要运行 activex 权限

<html>
<head>
<title> Open Word with javascript </title>
</head>
<body>
<input type=file id=dlgFile />
<input type=button value= "打开Word文档 " onclick= 'OpenFile() ' />
<script>
function OpenFile() {
try {
//debugger;
var wordApp = new ActiveXObject( "Word.Application ");
wordApp.Application.Visible = true;
wordApp.Documents.Open(dlgFile.value);
}
catch(e){
alert(e.message);
}
}
</script>
</body>
</html>