var isShowAll = false; var webOffice = null; var strTimeKey; function InitOffice() { webOffice = document.all.WebOffice1; EnableMenu(); OpenWeb(); strTimeKey = ""; var date = new Date(); strTimeKey += date.getFullYear(); //年 strTimeKey += date.getMonth() + 1; //月 月比实际月份要少1 strTimeKey += date.getDate(); //日 strTimeKey += date.getHours(); //HH strTimeKey += date.getMinutes(); //MM strTimeKey += date.getSeconds(); //SS } function SetTrack(track) { /// /// 设置留痕模式 /// /// 1-留痕模式 0-非留痕模式 x webOffice.SetTrackRevisions(track); } function SetUser() { /// /// 设置当前用户 /// var user = document.getElementById('TB_User').value; webOffice.SetCurrUserName(user); } function OpenWeb() { /// /// 打开服务器文件 /// try { var type = document.getElementById('TB_FileType').value; var url = location.href + "&action=LoadFile"; webOffice.LoadOriginalFile(url, type); SetUser(); var isTrack = document.getElementById('TB_Track').value; if (isTrack == 1) { SetTrack(1); } else { SetTrack(0); } var isRead = document.getElementById('TB_IsReadOnly').value; if (isRead == 1) { ProtectDoc(); } else { UnPortectDoc(); } InitShowName(); } catch (e) { alert(e.Message); } } function EnableMenu() { /// /// 设置按钮 /// var isPrint = document.getElementById('TB_IsPrint').value; if (isPrint == 1) { webOffice.HideMenuItem(0x01 + 0x02 + 0x04); } else { webOffice.HideMenuItem(0x01 + 0x02 + 0x04 + 0x10 + 0x20); } } function ShowTrack(track) { /// /// 显示留痕 /// /// 0-隐藏 1-显示 webOffice.ShowRevisions(track); } function SaveTrack() { /// /// 保存修订 /// // webOffice.AcceptAllRevisions(); webOffice.SetTrackRevisions(4); } function ReturnTrack() { /// /// 拒绝所有修订 /// var vCount = webOffice.GetRevCount(); var strUserName; for (var i = 1; i <= vCount; i++) { strUserName = webOffice.GetRevInfo(i, 0); webOffice.AcceptRevision(strUserName, 1); } } function InitShowName() { var count = webOffice.GetRevCount(); var showName = $("#sShowName"); showName.empty(); var list = "全部,"; //GetRevInfo(i,int) int=1 获取时间 int=3 获取内容 int=0 获取名字 for (var i = 1; i <= count; i++) { var strOpt = webOffice.GetRevInfo(i, 0); if (list.indexOf(strOpt) < 0) { list += strOpt + ","; } } var data = list.split(','); for (var i = 0; i < data.length; i++) { if (data[i] != null && data[i] != "") { var option = $("