打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Weboffice的使用(三)
  1. <div id="fckeditor" style="POSITION: relative;width:100%;height:460px;OVERFLOW:hidden;display:block"><!-- 正文 -->   
  2. <script type="text/javascript">   
  3.     var oFCKeditor = new FCKeditor('content');   
  4.     oFCKeditor.BasePath = "fckeditor/";   
  5.     oFCKeditor.Value ='';   
  6.     //oFCKeditor.Config["DefaultLanguage"] = fcklanguage;   
  7.     //oFCKeditor.FormatSource = false;   
  8.     //oFCKeditor.FormatOutput = false;   
  9.     //oFCKeditor.EnableXHTML = false;   
  10.     //oFCKeditor.EnableSourceXHTML = false;   
  11.     oFCKeditor.Height = 450 ;   
  12.     oFCKeditor.Width = '100%' ;   
  13.     oFCKeditor.Create();   
  14. </script>   
  15. </div>   
  16.   
  17. <div id="iWebOffice" style="POSITION: relative;width:100%;height:460px;OVERFLOW:hidden;display:none">   
  18. <object id="WebOffice" style="POSITION: relative;top:-20" width="100%" height="450px" classid="clsid:8B23EA28-723C-402F-92C4-59BE0E063499" codebase="/vplugin/iWebOffice2006.cab#version=7,5,4,0">   
  19.     <param name="WebUrl" value="<%=mServerUrl %>">   
  20.     <param name="RecordID" value="">   
  21.     <param name="Template" value="">   
  22.     <param name="FileName" value="">   
  23.     <param name="FileType" value="">   
  24.     <param name="UserName" value="">   
  25.     <param name="ExtParam" value="">   
  26.     <param name="EditType" value="1,1">   
  27.     <param name="PenColor" value="#FF0000">   
  28.     <param name="PenWidth" value="1">   
  29.     <param name="Print" value="1">   
  30.     <param name="ShowToolBar" value="0">   
  31.     <param name="ShowMenu" value="0">      
  32. </object>   
  33. </div>   
  34.   
  35. function onChangeDocType(docType){//改变文档类型   
  36.     var iWebOffice = document.getElementById("iWebOffice");   
  37.     var fckeditor = document.getElementById("fckeditor");   
  38.     switch(docType) {   
  39.         case 2://无正文   
  40.             iWebOffice.style.display='none';   
  41.             fckeditor.style.display='none';   
  42.             break;   
  43.         case 3://HTML   
  44.             iWebOffice.style.display='none';   
  45.             fckeditor.style.display='';   
  46.             break;   
  47.         case 4://word   
  48.             initObject('4',true);   
  49.             iWebOffice.style.display='';   
  50.             fckeditor.style.display='none';               
  51.             break;   
  52.         case 5://excel   
  53.             initObject('5',true);   
  54.             iWebOffice.style.display='';   
  55.             fckeditor.style.display='none';   
  56.             break;   
  57.         case 7://ppt   
  58.             initObject('7',true);   
  59.             iWebOffice.style.display='';   
  60.             fckeditor.style.display='none';   
  61.             break;   
  62.         default:   
  63.             break;   
  64.     }   
  65. }   
  66.   
  67. /*---------------------------iWebOffice处理---------------------*/  
  68. //作用:初始化iWebOffice对象   
  69. function initObject(fileType,bCreate){   
  70.     if (fileType=="5"){   
  71.         document.WebOffice.FileType = ".xls";   
  72.     }else if(fileType=="4"){   
  73.         document.WebOffice.FileType = ".doc";   
  74.     }else if(fileType=="7"){   
  75.         document.WebOffice.FileType = ".ppt";   
  76.     }   
  77.     try{   
  78.         document.WebOffice.CreateFile();    
  79.     // document.WebOffice.WebOpen();    
  80.     }catch(e){   
  81.     }   
  82.        
  83. }   
  84.   
  85. //作用:打开服务器文档   
  86. function LoadDocument(){   
  87. frm.WebOffice.FileName = "Test";   
  88. //frm.WebOffice.FileType = ".doc";   
  89. frm.WebOffice.EditType = "0,1";   
  90. if (!frm.WebOffice.WebOpen()){      //打开该文档    交互OfficeServer的OPTION="LOADFILE"   
  91.      alert(frm.WebOffice.Status);    //显示状态,从OfficeServer中读取   
  92. }else{   
  93.      alert(frm.WebOffice.Status);    //显示状态,从OfficeServer中读取   
  94. }   
  95. }   
  96. //作用:保存服务文档   
  97. function SaveDocument(){   
  98. document.WebOffice.FileName = "Test"+document.WebOffice.FileType;   
  99.     document.WebOffice.WebSave();   
  100. }   
  101. //作用:打印文档   
  102. function WebOpenPrint(){   
  103. try{   
  104.     VelcroForm.WebOffice.WebOpenPrint();   
  105.     StatusMsg(VelcroForm.WebOffice.Status);   
  106. }catch(e){}   
  107. }   
  108. //作用:页面设置   
  109. function WebOpenPageSetup(){   
  110.    try{   
  111.     if (VelcroForm.WebOffice.FileType==".doc"){   
  112.       VelcroForm.WebOffice.WebObject.Application.Dialogs(178).Show();   
  113.     }   
  114.     if(VelcroForm.WebOffice.FileType==".xls"){   
  115.       VelcroForm.WebOffice.WebObject.Application.Dialogs(7).Show();   
  116.     }   
  117.    }catch(e){}   
  118. }   
  119. //作用:保存office正文到本地   
  120. function savelocalFile(){   
  121.    try{   
  122.     document.WebOffice.WebSaveLocalFile();   
  123.    }catch(e){}   
  124. }   
  125. //作用:打开本地office文件   
  126. function openLocalFile(){   
  127.    try{   
  128.     document.WebOffice.WebOpenLocalFile();   
  129.    }catch(e){}   
  130. }   
  131.   
  132. 属性[Office公共]   
  133. Caption                            软件编号   
  134. WebUrl                           提交服务器程序路径   
  135. RecordID                        需要打开的记录号   
  136. Template                         需要使用的模版名   
  137. FileName                         需要打开的文件名   
  138. FileType                          需要打开的文件类型   
  139. EditType                         需要使用的方式   
  140. UserName                       用户名   
  141. Status                            当前插件状态   
  142. Error                             错误信息状态   
  143. ActiveDocument              文档对象接口   
  144. MsgFilepath                     当前文件目录   
  145.   
  146. 其中:RecordID,Template,FileName,FileType,EditType,UserName是全局参数。可供后台服务器程序使用。   
  147.   
  148. 语法: WebUrl    
  149. 特性: 只写    
  150. 类型: String    
  151. 功能: 设置服务器应用程序Url路径    
  152. 调用: WebOffice.WebUrl="http://www.dragongod.com/WebEditor/OfficeServer.asp"    
  153. 说明: OfficeServer.asp是一个服务器应用服务,用户可以根据自己的情况指定自己的应用程序名   
  154.   
  155. 语法: RecordId    
  156. 特性: 只写    
  157. 类型: String    
  158. 功能: 设置文档的纪录号    
  159. 调用: WebOffice.RecordId="324923100"    
  160. 说明: RecordId是一个文档的唯一标识,通过这个编号,可以在服务器上找到该文档,这个值也可以是其他字符如: "办公系统解决方案"  
  161.   
  162. 语法: Template    
  163. 特性: 只写    
  164. 类型: String    
  165. 功能: 设置模板编号    
  166. 调用: WebOffice.Template="10214563698"    
  167. 说明: Template是一个模板文档的唯一标识,通过这个模板编号,可以在服务器上找到该模板文档,这个值也可以是其他字符如: "办公系统解决方案模板"  
  168.   
  169. 语法: FileName    
  170. 特性: 只写    
  171. 类型: String    
  172. 功能: 设置文档名称    
  173. 调用: WebOffice.FileName="办公系统解决方案.doc"    
  174. 说明: FileName是一个文档的扩展属性,通过这个扩展属性,可以在服务器上找到该模板文档,这个值也可以是其他字符如: "办公系统解决方案模板"  
  175.   
  176.   
  177. 语法: FileType    
  178. 特性: 只写    
  179. 类型: String    
  180. 功能: 设置文档类型    
  181. 调用: WebOffice.FileType=".doc"    
  182. 说明: FileType是一个文档的类型,通过这个类型,决定打开的文档是Word还是Excel   
  183. FileType 为 “.doc” 或 “.xls”   
  184.           
  185. 语法: EditType    
  186. 特性: 只写    
  187. 类型: String    
  188. 功能: 设置文档打开方式 有两种付值方式:   
  189. WebOffice.EditType=”X”    ;    
  190.                                           X 的含义如下:   
  191.                                           “0” 只读、且不能拷贝,    
  192. 1” 起草编辑[可写无痕迹保留] ,    
  193. 2” 编辑[有痕迹保留]    
  194. 如果需要有痕迹保留功能,就可以设置为 WebOffice.EditType=”2”;   
  195.   
  196. 语法: UserName    
  197. 特性: 只写    
  198. 类型: String    
  199. 功能: 设置操作文档用户名    
  200. 调用: WebOffice.UserName="张三"    
  201. 说明: UserName是一个编辑文档的用户名   
  202.   
  203. 语法: Status    
  204. 特性: 只读    
  205. 类型: String    
  206. 功能: 返回当前状态    
  207. 调用: alert(WebOffice.Status);   
  208.   
  209. 语法: Error      
  210. 特性: 只读    
  211. 类型: String    
  212. 功能: 返回当前错误信息   
  213. 调用: alert(WebOffice.Error);   
  214.   
  215. 语法: ActiveDocument    
  216. 特性: 读写    
  217. 类型: Object    
  218. 功能: 返回Word或Excel对象,可用javascript脚本调用VBA对Word,Excel编程    
  219. 调用: alert(WebOffice.ActiveDocument.Application.UserName) 返回用户名,该用法请参考VBA    
  220.        如果是Word 文件,ActiveDocument 是Word 的 ActiveDocument对象   
  221.        如果是Excel 文件,ActiveDocument 是Excel 的ActiveSheet对象   
  222.        可以通过ActiveDocument.Application得到VBA的Application对象   
  223.   
  224. 方法:   
  225.   
  226.   
  227. LoadFile()                                   打开网络文档   
  228.                                                  输入参数 无。   
  229. 输出参数 返回成功或失败   
  230. 特别说明 Office公共   
  231.   
  232. SaveFile()                                   保存网络文档   
  233.                                                  输入参数 无。   
  234. 输出参数 返回成功或失败   
  235. 特别说明 Office公共   
  236.   
  237. Close()                                关闭所有文档   
  238.                                                  输入参数 无。   
  239. 输出参数 返回成功或失败   
  240. 特别说明 Office公共   
  241.   
  242.   
  243. LoadTemplate()                    调入网络模板   
  244.                                                  输入参数 无。   
  245. 输出参数返回设置成功或失败。   
  246. 特别说明 Office公共   
  247.   
  248. SaveTemplate()                    保存网络模板   
  249.                                                  输入参数 无。   
  250. 输出参数返回设置成功或失败。   
  251. 特别说明 Office公共   
  252.   
  253. UpdateFile()                         保存定稿的文档   
  254.                                                  输入参数 无。   
  255.   
  256. 输出参数 返回设置成功或失败。   
  257. 特别说明 Office公共   
  258.   
  259. GetMsgByName(FieldName)        取得服务器返回信息的值   
  260.                                                  输入参数:   
  261. FieldName 字段域名称   
  262. 输出参数 返回成功或失败。   
  263. 特别说明 Office公共   
  264.   
  265. SetMsgByName(FieldName, FieldValue)       设置相应值,等待发送给服务器   
  266.                                                  输入参数:   
  267. FieldName 字段域名称   
  268. FieldValue 字段域值   
  269. 输出参数 无   
  270. 特别说明 Office公共   
  271.   
  272. MsgTextClear ()                   清除由SetMsgByName设置的变量   
  273.                                                  输入参数 无。   
  274. 输出参数 无。   
  275. 特别说明 Office公共   
  276. MsgFileClear(FileName)        清除通过MsgFileLoad调入或服务器返回的文件   
  277. 输入参数:   
  278. FileName 文件名称   
  279. 输出参数 无   
  280. 特别说明 Office公共   
  281.   
  282. MsgFileLoad(FileName)        调入FileName所指定的文件   
  283. 输入参数:   
  284. FileName 文件名称   
  285. 输出参数 无   
  286. 特别说明 Office公共   
  287.   
  288. MsgFileSave(FileName)        保存FileName所指定的文件   
  289. 输入参数:   
  290. FileName 文件名称   
  291. 输出参数 无   
  292. 特别说明 Office公共   
  293.   
  294. SendToServer()                           发送由SetMsgByName设置的值给服务器   
  295.                                                  输入参数 无。   
  296. 输出参数 成功或失败。   
  297. 特别说明 Office公共   
  298.   
  299. Open(FileName,true)                   打开由FileName指定的文件   
  300. Save(FileName,true)                    保存由FileName指定的文件  
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
在线编辑office文档(Weboffice)源码下载 源程序
WebOffice控件的使用----后台操作
(转)C# Office操作
ASP.NET使用点聚WebOffice实现文档在线浏览
web在线编辑word,excel,pdf插件
Excel 插件开发经验分享|Excel 插件开发经验分享 | 重庆诺怀软件有限公司 软件开发, app开发, 微信开发, 小程序开发
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服