佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > Office文檔在線編輯的一個實現(xiàn)方法

Office文檔在線編輯的一個實現(xiàn)方法

熱門標(biāo)簽:呼叫中心市場需求 美圖手機 服務(wù)器配置 網(wǎng)站文章發(fā)布 鐵路電話系統(tǒng) 銀行業(yè)務(wù) 檢查注冊表項 智能手機
Office xp之后的版本支持通過webdav協(xié)議(http的擴展)直接編輯服務(wù)器上的文件。
IIS(6.0)支持webdav,這在IIS管理器的web服務(wù)擴展中可以看到.利用IIS作為webdav的服務(wù)器端,可以很容易的實現(xiàn)office(word,excel等)的在線編輯.
可以簡單的實驗一下:
確保IIS的webdav擴展安裝并被啟用了,建立一個虛擬目錄test,在其中放一個word文檔a.doc,然后打開word, 文件->打開->輸入word文檔的訪問url(http://localhost/test/a.doc),
修改一下文檔內(nèi)容,保存一下,發(fā)生了什么? 文檔被保存到服務(wù)器上了.
在IE中,可以通過js創(chuàng)建Word.Application,來打開,修改服務(wù)器上的文檔.
復(fù)制代碼 代碼如下:

wApp = new ActiveXObject("Word.Application.11");
wApp.Visible = true ;
wApp.Documents.Open( url );
if( trackRevisions ){ //可以實現(xiàn)痕跡保留呢
wApp.ActiveDocument.TrackRevisions = true ;
wApp.ActiveDocument.ShowRevisions = false ;
}else
{
wApp.ActiveDocument.TrackRevisions = false ;
wApp.ActiveDocument.ShowRevisions = false ;
}
wApp.ActiveDocument.Application.UserName= Global_CurrentUserName;

另外,安裝office時,會同時按裝一個ActiveX組件:Sharepoint.OpenDocuments,可么用此組件來激活word,編輯服務(wù)器上的文檔: var __OpenDocuments = null ;
復(fù)制代碼 代碼如下:

function Document_Edit2( url )
{
if( __OpenDocuments == null )
{
try{
__OpenDocuments = new ActiveXObject("SharePoint.OpenDocuments.3"); //for office 2007
}catch(e){}
if( __OpenDocuments == null || typeof(__OpenDocuments) == "#ff0000" )
{
try{
__OpenDocuments = new ActiveXObject("SharePoint.OpenDocuments.2"); //for office 2003
}catch(e){}
}
if( __OpenDocuments == null || typeof(__OpenDocuments) == "undefined" )
{
alert( "請安裝Word(2003或更高版本)" );
return ;
}
}
// openDocObj.ViewDocument("http://www.abc.com/documents/sample.doc");, "Word.Document"
//openDocObj.CreateNewDocument("http://www.abc.com/documents/sampleTemplate.dot", "http://www.abc.com/documents/");
var result = __OpenDocuments.EditDocument( url , "Word.Document" );
if( result == false )
{
alert( "無法打開文檔." );
}
}

可以看到,基于IIS的webdav支持,可以非常簡單的實現(xiàn)office文檔的在線編輯, 但有一個問題:這樣,文檔是存放在文件系統(tǒng)上,我們很多系統(tǒng)中,
文檔是存放在數(shù)據(jù)庫中的,這樣一來,如何實現(xiàn)呢???
I tried a lot and found the solution. It will be in the next article .

標(biāo)簽:滄州 上海 樂山 長治 沈陽 新疆 紅河 河南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Office文檔在線編輯的一個實現(xiàn)方法》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    博客| 兰坪| 章丘市| 长宁县| 普宁市| 崇仁县| 潞城市| 清苑县| 静宁县| 梅州市| 海南省| 渭源县| 富平县| 安平县| 永丰县| 中卫市| 沁水县| 太和县| 曲阜市| 伽师县| 桓台县| 灌南县| 大连市| 玉山县| 乃东县| 余庆县| 旺苍县| 灌南县| 南皮县| 汉中市| 荆州市| 青铜峡市| 改则县| 丰城市| 桦川县| 鄂伦春自治旗| 泽州县| 汤阴县| 伊宁县| 铁岭市| 尉犁县|