<script language="javascript">
//定義全局變量,用於清理工做
var word;
var doc;
function editFile(){
//調用word控件
word= new ActiveXObject("Word.Application");
//屏蔽「另存爲」按鈕
word.CommandBars("File").Controls(5).Enabled= false;
word.CommandBars("File").Controls(5).visible= false;
//屏蔽"另存爲網頁"按鈕
word.CommandBars("File").Controls(6).Enabled= false;
word.CommandBars("File").Controls(6).visible= false;
word.visible = true;
// word.activate();
try{
//打開文件
doc=word.Documents.Open("
http://212312.doc");
//痕跡保留
word.ActiveDocument.TrackRevisions =true;
//切換成web視圖
word.ActiveDocument.ActiveWindow.View.Type=3
}catch(e){
alert(e.message);
};
}
function myfinalize(){
//文檔保存
doc.save();
//文檔關閉
doc.close();
//把屏蔽的功能打開
word.CommandBars("File").Controls(5).Enabled= true;
word.CommandBars("File").Controls(5).visible= true;
//word退出
word.quit();
}
//參考文檔
http://bbs.hidotnet.com/712/ShowPost.aspx