欢迎大家关注 “西安e群人”微信公众号,每天会准时为您送上优质的能量养分和行业的资讯信息,为你的事业助力。
本博客唯一全国性的技术交流官方QQ群-- 互联网资源共享群英阁:658233229。 加群的朋友请按照加群提示和群公告活动,欢迎你们的到来,希望认识更多的同行业的朋友。

在线编辑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>

  

posted on 2014-03-06 16:40  云舜言传  阅读(1975)  评论(2)    收藏  举报