在线编辑word文档代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml%22 > 
<head runat="server"> 
<title>在线编辑文档</title> 
<script language="javascript" type="text/javascript"> 
var __OpenDocuments = null ; 

function documentEdit( url ) 
{ 
if( __OpenDocuments == null ) { 
try{ 
__OpenDocuments = new ActiveXObject("SharePoint.OpenDocuments.3"); //for office 2007 
} 
catch(e){} 

if( __OpenDocuments == null || typeof(__OpenDocuments) == "undefined" ) { 
try{ 
__OpenDocuments = new ActiveXObject("SharePoint.OpenDocuments.2"); //for office 2003 
} 
catch(e){} 
} 

if( __OpenDocuments == null || typeof(__OpenDocuments) == "undefined" ) { 
alert( "请安装Word(2003或更高版本)" ); 
return ; 
} 
} 
var result = __OpenDocuments.EditDocument( url , "Word.Document" ); 

if( result == false ) { 
alert( "无法打开文档." ); 
} 
} 
</script> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div> 
<input type="button" value="打开文档" onclick="documentEdit('http://moss07/ty/test/新建.doc');return false;" /> 
<a href="#"  onclick="documentEdit('http://moss07/ty/test/新建.doc');return false;">点击</a>
</div> 
</form> 
</body> 
</html>

  

原文地址:https://www.cnblogs.com/gxbk629/p/3584794.html