| 1 |
- function WebOffice2015(){this.dVersion="2.16.1.1";this.dUpdateDate="2016-1-1";this.FileType="";this.obj;this.Status="";this.ShowDialog={DialogNew:0,DialogOpen:1,DialogSaveAs:2,DialogSaveCopyAs:3,DialogPrint:4,DialogPageSetup:5,DialogProperties:6};this.FileName="";this.EditType=0;this.UserName="";this.setObj=function(object){this.obj=object;this.WebObject=this.obj};this.DocType={WOED:0,EXECL:1};this.HttpMethod={Get:0,Post:1};this.DOWN="\\WebOffice\\Down\\";this.UP="\\WebOffice\\UP\\";this.FilePath=null;this.tempInsertName="";this.DocTypeValue={DOC:0,DOCX:16,XLS:56,XLSX:51};this.DocSuffixType={0:".doc",12:".docx",56:".xls",51:".xlsx"};this.setVersion=-1;this.OfficeVersion={v2003:1,vOther:0};this.WebObject=null;this.sendMode=null;this.iWebOfficeTempName="iWebOfficeTempName.doc";this.Caption="DEMO演示平台";this.SetCaption=function(){this.Caption='"'+this.UserName+'"正在编辑文档';this.obj.Caption=this.Caption};this.Caption="DEMO演示平台";this.SetCaption=function(){this.Caption='"'+this.UserName+'"正在编辑文档';this.obj.Caption=this.Caption};this.SetUser=function(username){this.obj.User=username};this.CreateFile=function(){var docType=this.getDocType(this.FileType);switch(docType){case this.DocType.WOED:this.obj.CreateNew("Word.Document");break;case this.DocType.EXECL:this.obj.CreateNew("Excel.Sheet");break;default:this.obj.CreateNew("Word.Document");break}};this.getDocType=function(fileType){if(fileType==".doc"||fileType==".docx"||fileType==".wps"){return this.DocType.WOED}if(fileType==".xls"||fileType==".xlsx"||fileType==".et"){return this.DocType.EXECL}};this.HookEnabled=function(){if(this.getDocType(this.FileType)==this.DocType.WOED){this.obj.Style.ShowToolSpace=true;this.obj.SelectionInformationEnabled=false}if(!(window.ActiveXObject!=undefined||window.ActiveXObject!=null||"ActiveXObject"in window)){this.obj.HookEnabled=false}};this.WebOpenLocal=function(){this.setShowDialog(this.ShowDialog.DialogOpen,this.getOpenDocSuffix(this.FileType))};this.getOpenDocSuffix=function(fileType){if(fileType.length==5){fileType=fileType.substring(0,4)}var exts;exts="";if(this.isWPS()||!this.getOfficeVersion()){exts+="*"+fileType+"x|*"+fileType+"x|"}exts+="*"+fileType+"|*"+fileType+"|";exts+=this.getOpenSuffixName(fileType)+"(*"+fileType;if(this.isWPS()||!this.getOfficeVersion()){exts+=";*"+fileType+"x"}exts+=")|*"+fileType;if(this.isWPS()||!this.getOfficeVersion()){exts+=";*"+fileType+"x"}exts+="|";return exts};this.getEditVersion=function(){return this.obj.AppName};this.getOpenSuffixName=function(fileType){var openSuffixName;switch(fileType){case this.DocType.WOED:openSuffixName="Word Files";break;case this.DocType.EXECL:openSuffixName="Excel Files";break;default:openSuffixName="Word Files";break}return openSuffixName};this.setShowDialog=function(thisType,exts){switch(thisType){case this.ShowDialog.DialogOpen:this.obj.ShowDialog(thisType,exts,0);break;case this.ShowDialog.DialogNew:case this.ShowDialog.DialogPageSetup:case this.ShowDialog.DialogPrint:case this.ShowDialog.DialogProperties:case this.ShowDialog.DialogSaveCopyAs:case this.ShowDialog.DialogSaveAs:this.blnIE()?this.obj.ShowDialog(thisType):this.obj.ExecuteScript(thisType+"","ActiveObject.ShowDialog("+thisType+")");break;default:;break}};this.WebSaveLocal=function(){this.setShowDialog(this.ShowDialog.DialogSaveCopyAs)};this.WebPageSetup=function(){this.setShowDialog(this.ShowDialog.DialogPageSetup)};this.WebOpenPrint=function(){this.setShowDialog(this.ShowDialog.DialogPrint)};this.WebClose=function(){if(navigator.userAgent.indexOf("Firefox")>=0){return}this.Close()};this.PrintPreview=function(){this.obj.PrintPreview()};this.PrintPreviewExit=function(){this.obj.PrintPreviewExit()};var MenuFile;this.AppendMenu=function(index,Caption){var custommenu=this.obj.CustomMenu;if(MenuFile==undefined||MenuFile==null){custommenu.Clear();MenuFile=custommenu.CreatePopupMenu();custommenu.Add(MenuFile,"文件(&F)")}custommenu.AppendMenu(MenuFile,index,false,Caption);custommenu.Update()};this.AddCustomMenu=function(){var custommenu=this.obj.CustomMenu;var menufile=custommenu.CreatePopupMenu();var menufilelv2=custommenu.CreatePopupMenu();custommenu.AppendMenu(menufilelv2,6,false,"自定义二级菜单一");custommenu.AppendMenu(menufilelv2,7,false,"自定义二级菜单二");custommenu.AppendMenu(menufilelv2,0,false,"-");var menufilelv3=custommenu.CreatePopupMenu();custommenu.AppendMenu(menufilelv3,8,false,"自定义三级菜单一");custommenu.AppendMenu(menufilelv3,0,false,"-");custommenu.AppendMenu(menufilelv3,9,false,"自定义三级菜单二");custommenu.AppendMenu(menufilelv2,menufilelv3,true,"自定义三级菜单");custommenu.AppendMenu(menufilelv2,10,false,"自定义二级菜单三");custommenu.AppendMenu(menufile,menufilelv2,true,"自定义二级菜单");custommenu.AppendMenu(menufile,17,false,"启用保存");custommenu.AppendMenu(menufile,18,false,"禁止保存");custommenu.AppendMenu(menufile,0,false,"-");custommenu.AppendMenu(menufile,19,false,"启用打印");custommenu.AppendMenu(menufile,20,false,"禁止打印");custommenu.Add(menufile,"编辑(&E)");custommenu.Update()};this.WebOpen=function(mBoolean){var httpclient=this.obj.Http;httpclient.Clear();this.WebSetMsgByName("USERNAME",this.UserName);this.WebSetMsgByName("FILENAME",this.FileName);this.WebSetMsgByName("FILETYPE",this.FileType);this.WebSetMsgByName("RECORDID",this.RecordID);this.WebSetMsgByName("OPTION","LOADFILE");httpclient.AddForm("FormData",this.WebSendMessage());this.WebClearMessage();if(this.LOADFILE(httpclient)){this.Status="打开文档成功";return true}this.Status="打开文档失败";return false};this.WebSaveLocalFile=function(FileName){this.Save(FileName,this.getOfficeVersion(),this.FileType.substring(1).toUpperCase())};this.Save=function(FileName,is2003,FileType){if(is2003){this.obj.Save(FileName);return}this.obj.Save(FileName,eval("this.DocTypeValue."+FileType),true)};this.WebSave=function(){var httpclient=this.obj.Http;httpclient.Clear();this.WebSetMsgByName("USERNAME",this.UserName);this.WebSetMsgByName("RECORDID",this.RecordID);this.WebSetMsgByName("OPTION","SAVEFILE");this.WebSetMsgByName("FILENAME",this.FileName);this.WebSaveLocalFile(this.getFilePath()+this.FileName);this.Close();if(this.SAVEFILE(httpclient,this.FilePath+this.FileName)){this.Status="保存文件成功";return true}this.Status="保存文件失败";return false};this.SAVEFILE=function(httpclient,FileName){httpclient.AddForm("FormData",this.WebSendMessage());httpclient.AddFile("FileData",FileName);this.WebClearMessage();httpclient.ShowProgressUI=false;if(httpclient.Open(this.HttpMethod.Post,this.WebUrl,false)){if(!httpclient.Send()){if(httpclient.Status==0){if(!httpclient.Send()){return false}}}httpclient.Clear();return true}return false};this.LOADFILE=function(httpclient){httpclient.ShowProgressUI=true;if(httpclient.Open(this.HttpMethod.Post,this.WebUrl,false)){if(httpclient.Send()){if(httpclient.GetResponseHeader("MsgError")=="404"){this.CreateFile();this.getOfficeVersion();httpclient.Clear();return true}httpclient.Clear();if(this.hiddenSaveLocal(httpclient,this,false,false)){if(this.OpenLocalFile(this.FilePath+this.FileName)==0){this.getOfficeVersion();return true}else{var windows=window.confirm("打开文档错误,可能当前编辑软件不支持当前格式!\r\r单击“确定”关闭。单击“取消”继续。");if(windows==1){window.close()}return false}}}return false}};this.getFilePath=function(){var fs=this.obj.FileSystem;var filePath=fs.GetSpecialFolderPath(26)+this.UP;fs.CreateDirectory(filePath);this.FilePath=filePath;return this.FilePath};this.OpenLocalFile=function(filePath){return this.obj.Open(filePath)};this.hiddenSaveLocal=function(httpclient,webOffice,isHidden,isInsertFile,OtherName){if(isHidden){httpclient.Hidden=true}var tempName="";var fs=webOffice.obj.FileSystem;var filePath=fs.GetSpecialFolderPath(26)+webOffice.DOWN;fs.CreateDirectory(filePath);webOffice.FilePath=filePath;if(httpclient.Status==200){if(isInsertFile==undefined||isInsertFile==true){tempName="temp"+webOffice.RecordID;webOffice.tempInsertName=tempName+webOffice.FileName}if(OtherName==undefined||OtherName==""){OtherName=webOffice.FileName}httpclient.ResponseSaveToFile(filePath+tempName+OtherName);httpclient.Clear();return true}httpclient.Clear();return false};this.getOfficeVersion=function(){var getVersion=0;try{if(this.setVersion==-1){getVersion=parseFloat(this.obj.ActiveDocument.Application.Version);this.setVersion=getVersion}else{getVersion=this.setVersion}if(getVersion==11){return this.OfficeVersion.v2003}else{return this.OfficeVersion.vOther}}catch(e){return this.OfficeVersion.v2003}};this.Close=function(){this.obj.Close()};this.Activate=function(blnValue){this.obj.Activate(blnValue)};this.WebPageCode=function(){var FunctionString="ActiveObject.ActiveDocument.Application.Dialogs(294).Show()";this.blnIE()?this.obj.ActiveDocument.Application.Dialogs(294).Show():this.ExecuteScript("WebPageCode",FunctionString)};this.ExecuteScript=function(mValue,StringObject){this.obj.ExecuteScript(mValue,StringObject)};this.ShowTitleBar=function(mValue){var style=this.obj.Style;style.ShowTitleBar=mValue};this.ShowMenuBar=function(mValue){var style=this.obj.Style;style.ShowMenuBar=mValue};this.ShowToolBars=function(mValue){var style=this.obj.Style;style.ShowToolBars=mValue};this.ShowStatusBar=function(mValue){var style=this.obj.Style;style.ShowStatusBar=mValue};this.FullSize=function(mValue){this.obj.FullSize=mValue};this.WebShow=function(blnValue){if(this.getDocType(this.FileType)==this.DocType.WOED){this.VBAShowRevisions(blnValue)}};this.SaveEnabled=function(mBoolean){this.obj.SaveEnabled=mBoolean};this.PrintEnabled=function(mBoolean){this.obj.PrintEnabled=mBoolean};this.WebSetProtect=function(Boolean,password){var docType=this.getDocType(this.FileType);if(password==""){password="123456"}Boolean?this.VBAProtectDocument(docType,password):this.VBAUnProtectDocument(docType,password)};this.WebSetBookmarks=function(vbmName,vbmValue){this.VBASetBookmarks(vbmName,vbmValue)};this.WebOpenBookMarks=function(){var FunctionString="ActiveObject.ActiveDocument.Application.Dialogs(168).Show()";this.blnIE()?this.obj.ActiveDocument.Application.Dialogs(168).Show():this.ExecuteScript("WebPageCode",FunctionString)};this.WebAddBookMarks=function(BMarksName,BMarksValue){if(!this.obj.ActiveDocument.BookMarks.Exists(BMarksName)){var BMVLength=BMarksValue.length;this.obj.ActiveDocument.Application.Selection.TypeText(BMarksValue);this.obj.ActiveDocument.Application.Selection.MoveLeft(Unit=1,Count=BMVLength);var StartR=this.obj.ActiveDocument.Application.Selection.Start;var EndR=this.obj.ActiveDocument.Application.Selection.Start+BMVLength;this.obj.ActiveDocument.Range(Start=StartR,End=EndR).Select();this.obj.ActiveDocument.Bookmarks.Add(BMarksName)}};this.WebFindBookMarks=function(BMarksName){var range=this.obj.Range;range=this.obj.ActiveDocument.Bookmarks(BMarksName).Range;range.Select()};this.WebDelBookMarks=function(BMarksName){if(this.obj.ActiveDocument.BookMarks.Exists(BMarksName)){this.obj.ActiveDocument.Bookmarks(BMarksName).Delete()}};this.WebGetDocSuffix=function(){try{var docType=this.getDocType(this.FileType);var FileTypeValue=0;if(docType==this.DocType.WOED){this.Activate(true);FileTypeValue=this.obj.ActiveDocument.SaveFormat}if(docType==this.DocType.EXECL){this.obj.ExitExcelEditMode();FileTypeValue=this.obj.ActiveDocument.FileFormat;if(FileTypeValue<0){FileTypeValue=56}}return this.DocSuffixType[FileTypeValue]}catch(e){return this.FileType}};this.WebFullName=function(){return this.obj.FullName};this.BookMark="";this.ImageName="";this.WebInsertImage=function(BookMark,ImageName){var httpclient=this.obj.Http;this.sendMode="LoadImage";this.BookMark=BookMark;this.ImageName=ImageName;var URL=this.WebUrl.substring(0,this.WebUrl.lastIndexOf("/"));httpclient.ShowProgressUI=false;if(httpclient.Open(this.HttpMethod.Post,URL+"/Document/"+ImageName,true)){httpclient.Send();httpclient.Clear()}};this.InsertImageByBookMark=function(){if(this.BookMark==null||this.BookMark=="null"||this.BookMark==""){this.obj.ActiveDocument.Application.Selection.GoTo(-1,0,0,this.BookMark)}this.obj.ActiveDocument.Application.Selection.InlineShapes.AddPicture(this.FilePath+this.ImageName);this.obj.ActiveDocument.InlineShapes.Item(1).ConvertToShape();this.obj.ActiveDocument.Shapes.Item(1).WrapFormat.Type=5;return true};this.WebInsertFile=function(){var httpclient=this.obj.Http;this.WebSetMsgByName("FILENAME",this.FileName);this.WebSetMsgByName("OPTION","LOADFILE");httpclient.AddForm("FormData",this.WebSendMessage());this.WebClearMessage();if(this.LOADFILE(httpclient)){this.Status="打开文档成功";return true}this.Status="打开文档失败";return false};this.DownloadToFile=function(DownFileName,SavePath){var httpclient=this.obj.Http;var URL=this.WebUrl.substring(0,this.WebUrl.lastIndexOf("/"));httpclient.ShowProgressUI=false;if(httpclient.Open(this.HttpMethod.Get,URL+"/Document/"+DownFileName,false)){if(httpclient.Send()){if(httpclient.Status==200){httpclient.ResponseSaveToFile(SavePath+DownFileName);httpclient.Clear();return true}}}httpclient.Close();return false};this.ArrayList=function(){this.ObjArr={};this.Count=0;this.Add=function(key,value){this.ObjArr[key]=value;this.Count++;return true};this.Clear=function(){this.ObjArr={};this.Count=0};this.toString=function(){var newArray=new Array;var i=0;for(var i in this.ObjArr){newArray.push("'"+i+"':'"+this.ObjArr[i]+"'")}return"{"+newArray+"}"}};this.ht=new this.ArrayList;this.WebSetMsgByName=function(FieldName,FieldValue){this.ht.Add(FieldName,FieldValue)};this.WebSendMessage=function(){return this.ht.toString()};this.WebClearMessage=function(){this.ht.Clear()};this.blnIE=function(){return window.ActiveXObject!=undefined||window.ActiveXObject!=null||"ActiveXObject"in window};this.isWPS=function(){return this.FileType.toUpperCase()==".WPS"||this.FileType.toUpperCase()==".ET"};this.Version=function(){return this.obj.Version};this.WebEnableCopy=function(mValue){switch(mValue){case 0:case false:case"0":this.obj.CopyEnabled=false;break;case 1:case"1":case true:this.obj.CopyEnabled=true;break;default:;return}};this.WebDelFile=function(FileName){var fs=this.obj.FileSystem;fs.DeleteFile(FileName)};this.setEditType=function(type){try{switch(type){case"0":this.VBAProtectDocument(this.getDocType(this.FileType),"123");break;case"1":this.WebShow(false);break;case"2":this.WebShow(true);break;default:}}catch(e){return false}};this.VBAShowRevisions=function(mValue){if(this.getDocType(this.FileType)==this.DocType.WOED&&this.obj.ActiveDocument.ProtectionType=="-1"){this.obj.ActiveDocument.TrackRevisions=mValue;this.obj.ActiveDocument.ShowRevisions=mValue;return true}return false};this.VBAProtectDocument=function(docType,password){if(docType==this.DocType.WOED){if(this.obj.ActiveDocument.ProtectionType=="-1"){this.obj.ActiveDocument.Protect(3,false,password);return}}if(docType==this.DocType.EXECL){if(!this.obj.ActiveDocument.Application.Sheets(1).ProtectContents){this.obj.ActiveDocument.Application.Sheets(1).Protect(password)}return}return false};this.VBAUnProtectDocument=function(docType,password){if(docType==this.DocType.WOED){this.obj.ActiveDocument.Unprotect(password);return}if(docType==this.DocType.EXECL){this.obj.ActiveDocument.Application.Sheets(1).Unprotect(password);return}};this.VBASetBookmarks=function(vbmName,vbmValue){try{this.obj.ActiveDocument.Bookmarks(BookMarkName).Range.Text=BookMarkValue}catch(e){return false}};this.VBAInsertFile=function(Position,FileName){try{this.obj.ActiveDocument.Application.Selection.GoTo(-1,0,0,Position);this.obj.Activate(true);this.obj.ActiveDocument.Application.Selection.InsertFile(FileName,"",false,false,false);return true}catch(e){return false}};this.WebAcceptAllRevisions=function(){try{this.obj.Activate(true);this.obj.ActiveDocument.Revisions.AcceptAll();return this.obj.ActiveDocument.Revisions.Count>=0?true:false}catch(e){return false}};this.VBASetUserName=function(UserName){try{this.obj.ActiveDocument.Application.UserName=UserName}catch(e){return false}};this.ShowField=function(){try{this.obj.ActiveDocument.ActiveWindow.View.ShowDrawings=true;this.obj.ActiveDocument.ActiveWindow.View.ShowFieldCodes=true}catch(e){return false}};this.WebAreaProtect=function(BMarksName){if(!this.obj.ActiveDocument.BookMarks.Exists(BMarksName)){alert("文件内没有名称为'"+BMarksName+"'的书签 ,请先添加书签!");return}var range=this.obj.Range;range=this.obj.ActiveDocument.Bookmarks(BMarksName).Range;range.Select();this.obj.ActiveDocument.bookmarks(BMarksName).range.editors.add(-1);this.obj.ActiveDocument.Protect(3,false,"123",false,false);this.obj.ActiveDocument.Application.Selection.MoveLeft(Unit=1,Count=1);this.obj.ActiveDocument.ActiveWindow.View.ShadeEditableRanges=false};this.WebAreaUnprotect=function(BMarksName){if(this.obj.ActiveDocument.BookMarks.Exists(BMarksName)){try{this.obj.ActiveDocument.Unprotect("123");var range=this.obj.Range;range=this.obj.ActiveDocument.Bookmarks(BMarksName).Range;range.Select();this.obj.ActiveDocument.DeleteAllEditableRanges(-1)}catch(e){}}else{alert("不存在该书签!");return}};this.Skin=function(typeColor){switch(typeColor){case"purple":this.setColor("purple");this.Status="set pink success";break;case"black":this.setColor("black");this.Status="set black success";break;case"white":this.setColor("white");this.Status="set black success";break;case"blue":this.setColor("blue");this.Status="set black success";break;case"yellow":this.setColor("yellow");this.Status="set black success";break}};this.setColor=function(typeColor){var titleBarColor;var menuBarStartColor;var menuBarButtonStartColor;var menuBarButtonEndColor;var menuBarButtonFrameColor;var CustomToolbarStartColor;switch(typeColor){case"purple":titleBarColor=13408716;CustomToolbarStartColor=13408716;menuBarStartColor=13408716;menuBarButtonStartColor=16777215;menuBarButtonEndColor=11373997;menuBarButtonFrameColor=6697830;break;case"black":titleBarColor=6579300;CustomToolbarStartColor=6579300;menuBarStartColor=12039604;menuBarButtonStartColor=15919861;menuBarButtonEndColor=15919861;menuBarButtonFrameColor=15919861;break;case"white":titleBarColor=13025726;CustomToolbarStartColor=13025726;menuBarStartColor=16118770;menuBarButtonStartColor=15919861;menuBarButtonEndColor=15919861;menuBarButtonFrameColor=15919861;break;case"blue":titleBarColor=14005919;CustomToolbarStartColor=14005919;menuBarStartColor=16577519;menuBarButtonStartColor=15919861;menuBarButtonEndColor=15919861;menuBarButtonFrameColor=15919861;break;case"yellow":titleBarColor=52479;CustomToolbarStartColor=52479;menuBarStartColor=6994431;menuBarButtonStartColor=15919861;menuBarButtonEndColor=15919861;menuBarButtonFrameColor=15919861;break}var style=this.obj.Style;style.TitleBarColor=titleBarColor;style.TitleBarTextColor=0;style.MenuBarStartColor=menuBarStartColor;style.MenuBarEndColor=16777215;style.MenuBarTextColor=0;style.MenuBarHighlightTextColor=0;style.MenuBarButtonStartColor=menuBarButtonStartColor;style.MenuBarButtonEndColor=menuBarButtonEndColor;style.MenuBarButtonFrameColor=menuBarButtonFrameColor;style.CustomToolbarStartColor=CustomToolbarStartColor;style.Invalidate()};this.AddToolbar=function(){this.obj.Handwritting.Show=!this.obj.Handwritting.Show;var URL=this.WebUrl.substring(0,this.WebUrl.lastIndexOf("/"));var customtoolbar=this.obj.CustomToolbar;customtoolbar.AddToolButton(301,"手写签名",URL+"/HandWrite/"+"shouxie24.png","手写签名",0);customtoolbar.AddToolButton(302,"停止手写",URL+"/HandWrite/"+"tingzhi24.png","停止手写",0);customtoolbar.AddToolButton(303,"文字签名",URL+"/HandWrite/"+"wenzi24.png","文字签名",0);customtoolbar.AddToolButton(300,"-","","",1);customtoolbar.AddToolButton(304,"图形签名",URL+"/HandWrite/"+"tuxing24.png","图形签名",0);customtoolbar.AddToolButton(305,"取消上一个签批",URL+"/HandWrite/"+"quxiao24.png","取消上一个签批",0);customtoolbar.AddToolButton(306,"显示用户签批",URL+"/HandWrite/"+"xianshi24.png","显示用户签批",0)};this.HandWriting=function(penColor,penWidth){var handwritting=this.obj.Handwritting;var handsetting=handwritting.DrawingSetting;handsetting.PenThicker=penWidth;handsetting.PenColor=penColor;handwritting.AnnotateDraw();this.ShowMenuBar(false);this.ShowToolBars(false)};this.StopHandWriting=function(){var handwritting=this.obj.Handwritting;handwritting.StopAnnotate();WebOffice.ShowMenuBar(true);WebOffice.ShowToolBars(true)};this.TextWriting=function(){var handwritting=this.obj.Handwritting;var textsetting=handwritting.TextSetting;textsetting.TextSize=32;textsetting.TextColor=12255487;textsetting.FontName="宋体";handwritting.AnnotateText();this.ShowMenuBar(false);this.ShowToolBars(false)};this.ShapeWriting=function(){var handwritting=this.obj.Handwritting;var shapesetting=handwritting.ShapeSetting;shapesetting.ShapeType=0;shapesetting.BackgroundColor=16777215;shapesetting.BorderColor=16711680;shapesetting.BorderWidth=6;handwritting.AnnotateShape();this.ShowMenuBar(false);this.ShowToolBars(false)};this.RemoveLastWriting=function(){var handwritting=this.obj.Handwritting;handwritting.RemoveLast()};this.ShowWritingUser=function(bVal,username){var strxml=this.obj.GetAnnotations();var json=eval("("+strxml+")");if(username!=""&&username!=null&&username!=undefined){for(var i=0;i<json.Annotations.length;i++){if(json.Annotations[i].Annotation.User!=username){var id=json.Annotations[i].Annotation.ID;this.obj.GetAnnotationByID(id).Visible=bVal}}}else{for(var i=0;i<json.Annotations.length;i++){var id=json.Annotations[i].Annotation.ID;this.obj.GetAnnotationByID(id).Visible=bVal}}};this.ShowCustomToolbar=function(bVal){this.obj.Style.ShowCustomToolbar=bVal};this.WebSavePDF=function(){var httpclient=this.obj.Http;httpclient.Clear();this.WebSetMsgByName("RECORDID",this.RecordID);this.WebSetMsgByName("OPTION","SAVEPDF");this.WebSetMsgByName("FILENAME",this.RecordID+".pdf");this.SaveAsPdf(this.getFilePath()+this.RecordID+".pdf");if(this.SAVEFILE(httpclient,this.getFilePath()+this.RecordID+".pdf")){this.Status="保存文件成功";alert("保存PDF成功!");return true}this.Status="保存文件失败";return false};this.SaveAsPdf=function(FilePath){if(this.FileType==".doc"||this.FileType==".docx"||this.FileType==".wps"){try{this.obj.ActiveDocument.ExportAsFixedFormat(FilePath,17,false,0,0,1,1,0,true,true,0,true,true,true)}catch(e){return this.e.description}return true}};this.SaveAsHtml=function(FilePath){if(this.FileType==".doc"||this.FileType==".docx"||this.FileType==".wps"){try{var ret=this.obj.ActiveDocument.SaveAs(FilePath,8,false,"",false,"",false,false,false,false,false,0);this.obj.ActiveDocument.Application.ActiveWindow.View.type=3}catch(e){return this.e.description}return true}};this.WebSaveHtml=function(){if(this.SaveAsHtml("D:\\"+this.RecordID+".html")){alert("保存Html成功!\n保存路径: "+"D:\\"+this.RecordID+".html")}};this.WebRunMacro=function(MarcroName,MacroValue){try{var VBAStr=MacroValue;var VBCom;VBCom=this.obj.ActiveDocument.VBProject.VBComponents.Add(1);VBCom.CodeModule.AddFromString(VBAStr);this.obj.ActiveDocument.Application.Run(MarcroName);return true}catch(e){return false}}}
|