當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
JavaScript Office文档在线编辑备忘
生活随笔
收集整理的這篇文章主要介紹了
JavaScript Office文档在线编辑备忘
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
來源:
http://www.cnblogs.com/jianyi0115/articles/677712.html
http://www.cnblogs.com/fxwdl/archive/2009/09/13/1565795.html
在此作備忘:
?2?<html?xmlns="http://www.w3.org/1999/xhtml">
?3?<head>
?4?<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
?5?<title>無標題文檔</title>
?6?</head>
?7?
?8?<body>
?9???<script?type="text/javascript"?language="javascript">
10?
11?????function?getSPOpenDocumentObject()
12?????{
13????????if(window.SharePointOpenDocuments)
14????????{
15???????????return?window.SharePointOpenDocuments;
16????????}
17????????else
18????????{
19???????????//3?-office07??2-office03
20???????????var?spIDS=['SharePoint.OpenDocuments.3','SharePoint.OpenDocuments.2','SharePoint.OpenDocuments.1'];
21???????????for(var?i=0;i<spIDS.length;i++)
22???????????{
23??????????????try
24??????????????{
25?????????????????return?(window.SharePointOpenDocuments=new?ActiveXObject(spIDS[i]));
26??????????????}
27??????????????catch($e){}
28???????????}
29????????}
30?????}
31???</script>
32?????<input?type="button"?id="btntest"?value="開始編輯"?/>
33?????<script?type="text/javascript">
34?
35????????document.getElementById('btntest').onclick=function(){?????
36????????var?__OpenDocuments?=getSPOpenDocumentObject();
37???????????var?url='****.doc';
38???if(__OpenDocuments)
39???????????{
40?????????????var?result?=?__OpenDocuments.EditDocument(?url?,?"Word.Document"?);??????//Word.Document可以換成非WORD的文檔.
41????????????????????
42?????????????if(?result?==?false?)
43?????????????{
44???????????????alert(?"無法打開文檔."?);
45?????????????}????
46???????????}
47????????};
48?????</script>
49?</body>
50?</html>
51?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/McJeremy/archive/2009/12/16/1625280.html
總結(jié)
以上是生活随笔為你收集整理的JavaScript Office文档在线编辑备忘的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: software enginer1
- 下一篇: C# 时间日期