基于ntkoocx.js的在线word编辑
来源:互联网 发布:淘宝店铺的客服电话 编辑:程序博客网 时间:2024/05/22 04:30
其中最关键ntkoocx.js的方法:
//Save Documentfunction TANGER_OCX_SaveDoc(op_flag) { TANGER_OCX_SaveEditToServerDisk(); //保存 if (op_flag == 1) { TANGER_OCX_bDocOpen = false; window.close(); }}
下面这个方法会向服务器端发送保存请求:
function TANGER_OCX_SaveEditToServerDisk() { if (!TANGER_OCX_bDocOpen) { alert("当前没有文档被打开."); return; } TANGER_OCX_filename = document.all.item("filename").value; if ((typeof (TANGER_OCX_filename) == "undefined") || (!TANGER_OCX_filename) || (strtrim(TANGER_OCX_filename) == "")) { alert("You must input a file name."); return; } var newwin, newdoc; try { if (!TANGER_OCX_doFormOnSubmit()) return; //we may do onsubmit first //call SaveToURL WITOUT other form data var retHTML = TANGER_OCX_OBJ.SaveToURL(document.forms[0].action,"EDITFILE","docFileName=" + escape(TANGER_OCX_filename), //other params seperrated by '&'. For example:myname=tanger&hisname=tomTANGER_OCX_filename //filename); //this function returns dta from server //open a new window to show the returned data //newwin = window.open("","_blank","left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1",false); //newdoc = newwin.document; //newdoc.open(); //newdoc.write("<html><head><title>服务器返回数据:</title></head><body><center><hr>") //newdoc.write("文件已保存!"+"<hr>"); //newdoc.write("<input type=button VALUE='继续编辑' onclick='window.close()'> <input type=button VALUE='关闭窗口' onclick='opener.close();window.close()'>"); //newdoc.write('</center></body></html>'); //newdoc.close(); if (window.opener) { //window.opener.location.reload(); } //window.close(); } catch (err) { alert("err:" + err.number + ":" + err.description); } finally { }}
之后就可在uploaddisk.aspx.cs文件中指定,保存的word路径
namespace BieoS.Presentation.MainPresentation.Main_Classic.Document.Resource{ public partial class uploaddisk : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { doFormUploadDisk(); } public void doFormUploadDisk() { //string docguid = Request.QueryString["pDocId"].ToString(); //var service = SpringContext.GetObject<ISingleService<IEntity>>("SingleService"); //Attachment attachment = service.Get<Attachment>(docguid); //string uploadpath =""; //if (attachment != null) //{ // uploadpath = Attachment.DefaultSaveRoot + attachment.RelativePath + attachment.FileName;// "online\\";// new iEAA.IiEAAFacade.IBSiEAAFacade().GetFullPhysicalPath(strFolderGuid); //} //else //{ // uploadpath = Request.PhysicalApplicationPath + "/Temp/" + docguid; //} string uploadpath = Request.PhysicalApplicationPath + "/UpFile/htm/" + Server.UrlDecode(Request.Form["docFileName"]); System.Web.HttpFileCollection uploadFiles = Request.Files; System.Web.HttpPostedFile theFile; for (int i = 0; i < uploadFiles.Count; i++) { theFile = uploadFiles[i]; if (uploadFiles.GetKey(i).ToUpper() == "EDITFILE") { //string filename = theFile.FileName.Substring(theFile.FileName.LastIndexOf('\\') + 1); theFile.SaveAs(uploadpath);// + @"\" + filename); //Response.Write("Files: " + filename + "<br>"); //Response.Write("Size: " + theFile.ContentLength.ToString() + "bytes<br>"); } } } }}
实现效果如下:
所用示例及说明下载:http://download.csdn.net/detail/yuewei19/9580558
0 0
- 基于ntkoocx.js的在线word编辑
- Word在线编辑
- Word在线编辑
- 在线编辑word文档
- 在线编辑word功能
- 在线编辑word文档
- 在线编辑word文档
- 基于SSM 的 Office 在线编辑
- 基于Android的Word在线预览
- 基于Android的Word在线预览
- 一个在线编辑js的地方
- 在线编辑word文档代码
- word 远程在线编辑保存
- 轻松实现Word在线编辑
- 保存在线word编辑的内容到服务器
- Office word excel电子表格在线编辑的实现方法
- 自己开发基于Web的在线编辑文档控件,可以在线编辑任意文档
- ArcGIS Server 9.2实现基于web浏览器的在线编辑
- Android取消EditText自动获取焦点默认行为
- 虚拟机里安装kali系统
- 20160718 继承
- 关于使用Initramfs来挂载根文件系统的一些理解
- Nosql 背景
- 基于ntkoocx.js的在线word编辑
- ios创建证书文件
- linux系统安装、使用中的问题和clock_t计时问题
- 11A - Increasing Sequence
- sed命令
- socket通讯,客户端获取数据丢失问题
- ubuntu10.04 编译安装gcc-5.3.0
- 在android中使用OkHttp框架处理网络请求
- 【BZOJ】2005 [Noi2010]能量采集