附录2系统核心功能代码摘录.docx
- 文档编号:3519416
- 上传时间:2022-11-23
- 格式:DOCX
- 页数:12
- 大小:18.04KB
附录2系统核心功能代码摘录.docx
《附录2系统核心功能代码摘录.docx》由会员分享,可在线阅读,更多相关《附录2系统核心功能代码摘录.docx(12页珍藏版)》请在冰豆网上搜索。
附录2系统核心功能代码摘录
附录2:
E时代安全电子文档系统V2.0
部分核心功能代码摘录
开发平台:
WindowsServer2008+VS2012+SQL2005+IIS
DocView.htm
DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
//www.w3.org/1999/xhtml">
onbeforecopy="returnfalse"style="background: #ccc;padding: 10px;"> vars=" E77E049B-23FC-4DB8-B756-60529A35FAD5'codebase='weboffice_v6.0.5.0.cab#version=6,0,5,0'style='LEFT: 0px;TOP: 0px'>"; s+=" s+=" s+=""; document.write(s); //在装载完Weboffice(执行) //控件后执行"WebOffice1_NotifyCtrlReady"方法 //WebOffice1_NotifyCtrlReady(); -- WebOffice1_NotifyWordEvent(eventname); //--> varwebObj; functiongetUrlParam(name) { varreg=newRegExp("(^|&)"+name+"=([^&]*)(&|$)");//构造一个含有目标参数的正则表达式对象 varr=window.location.search.substr (1).match(reg);//匹配目标参数 if(r! =null)returnunescape(r[2]);returnnull;//返回参数值 } $(document).ready(function(){ varfile=decodeURIComponent(getUrlParam('fileurl')); varfilename=file.replace(/.*(\/|\\)/,""); varfileExt=(/[.]/.exec(filename))? /[^.]+$/.exec(filename.toLowerCase()): ''; if(".doc.xls.ppt.docx.xlsx.pptx.wps.dps.et.pdf".indexOf(fileExt)>-1){ WebOffice1_NotifyCtrlReady(file,fileExt); } if(".jpg.png.bmp.gif".indexOf(fileExt)>-1){ //alert("图片预览"); document.write(" } if(".txt.cs.py".indexOf(fileExt)>-1) { //alert("文本文件预览"); window.location.href=file; //$("#txtView").html(window.location.href=file); } }); functionWebOffice1_NotifyCtrlReady(file,fileExt){ document.all.WebOffice1.ReadOnly=false; webObj=document.getElementById("WebOffice1"); webObj.HideMenuAction(5,0);//激活设置 webObj.ShowToolBar=false; //新建文档 webObj.LoadOriginalFile(file,fileExt); webObj.ProtectDoc(1,1,"etimes20112"); webObj.SetSecurity(0x01);//禁打印 webObj.SetSecurity(0x02);//禁保存 webObj.SetSecurity(0x04);//禁复制 webObj.SetToolBarButton2("MenuBar",1,0);//隐藏office2003文件菜单 webObj.SetToolBarButton2("MenuBar",2,0);//隐藏office2003编辑菜单 webObj.SetToolBarButton2("Standard",1,0);//隐藏office2003新建按钮 webObj.SetToolBarButton2("Standard",2,0);//隐藏office2003打开按钮 webObj.SetToolBarButton2("MenuBar",1,8);//隐藏菜单 webObj.SetToolBarButton2("Standard",1,8);//隐藏常用工具栏 webObj.SetToolBarButton2("Formatting",1,8);//隐藏格式工具栏 webObj.HideMenuItem(0x01+0x8000); webObj.HideMenuItem(0x02+0x8000); webObj.HideMenuItem(0x04+0x8000); webObj.HideMenuAction(1,0x100000+0x200000+0x400000+0x800000+0x1000000+0x2000000+0x4000000+0x8000000+0x10000000); webObj.HideMenuAction(5,0);//激活设置 webObj.ShowToolBar=false; } functionWebOffice1_NotifyWordEvent(eventname){ if(eventname=="DocumentBeforeSave"){ document.all.WebOffice1.lContinue=0; alert("此文档已经禁止保存"); }elseif(eventname=="DocumentBeforePrint"){ document.all.WebOffice1.lContinue=0; alert("此文档已经禁止打印"); }elseif(eventname=="WindowSelectionChange"){ document.all.WebOffice1.lContinue=0; }elseif(eventname=="DocumentBeforeClose"){ document.all.WebOffice1.lContinue=0; } } functionCloseWord(){ webObj.CloseDoc(0); } //页面关闭时操作 $(window).unload(function(){ try{ varwebObj=document.getElementById("WebOffice1"); webObj.Close(); }catch(e){ } }); 96%;height: 680px;display: none"id="txtView">loading...