Dsoframer控件实现office在线编辑
2013-12-09 12:10
513 查看
代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 实现方法如下: 1、下载控件并添加到工具箱中。 2、页面实现方法 <%@ Page Language="C#" AutoEventWireup="true" Codebehind="WebForm1.aspx.cs" Inherits="zzuoa.web.dsoframer.WebForm1" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> <script language="javascript" type="text/javascript"> function openword() { document.all.FramerControl1.Open("http://localhost:2473/web/DownFile/1.doc",false,"Word.Document"); } function SaveDoc() { var returnValue; // 保存页面的返回值 document.all.FramerControl1.HttpInit(); // 初始化Http引擎 // 添加相应的Post元素 document.all.FramerControl1.HttpAddPostString("11", "22"); // 添加上传文件 document.all.FramerControl1.HttpAddPostCurrFile("Filedate ", ""); // 提交上传文件 returnValue = document.all.FramerControl1.HttpPost("../dsoframer/saveword.aspx"); if ("true" == returnValue) { alert("文件上传成功"); } else { alert("文件上传成功") } } function FramerControl1_BeforeDocumentSaved() { if (confirm("是否保存到服务器")) { SaveDoc(); } } </script> <script language="javascript" for="FramerControl1" event="BeforeDocumentSaved"> <!-- FramerControl1_BeforeDocumentSaved() //--> </script> </head> <body onload="openword();"> <form id="Form1" method="post" enctype="multipart/form-data" runat="server"> <div> <object id="FramerControl1" codebase="dsoframer.cab" height="100%" width="99%" classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57" lang="chn"> <param name="BorderStyle" value="1"> <param name="TitlebarColor" value="52479"> <param name="TitlebarTextColor" value="0"> <param name="Menubar" value="1"> </object> </div> </form> </body> </html> saveword.aspx页面后台代码实现保存word到服务器 using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using System.Data.SqlClient; using System.Data.SqlTypes; using System.Text; namespace zzuoa.web.dsoframer { public partial class saveword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { BinaryReader bReader = new BinaryReader(Request.InputStream); string strTemp = Encoding.GetEncoding("iso-8859-1").GetString( bReader.ReadBytes((int)bReader.BaseStream.Length), 0, (int)bReader.BaseStream.Length); string match = "Content-Type: application/msword\r\n\r\n"; int pos = strTemp.IndexOf(match) + match.Length; bReader.BaseStream.Seek(pos, SeekOrigin.Begin); string newFile = Server.MapPath("~/web/DownFile/1.doc"); FileStream newDoc = new FileStream(newFile, FileMode.Create, FileAccess.Write); BinaryWriter bWriter = new BinaryWriter(newDoc); bWriter.BaseStream.Seek(0, SeekOrigin.End); while (bReader.BaseStream.Position < bReader.BaseStream.Length - 38) bWriter.Write(bReader.ReadByte()); bReader.Close(); bWriter.Flush(); bWriter.Close(); } } }
有关于dsoframer组件的文章,写了组件的一些api函数,可以查询。
原文地址:http://hi.baidu.com/fdsfsd%B1%F9%D3%EA/blog/item/f86fb533a4ebe695a8018e53.html
相关文章推荐
- dsoframer控件实现office在线编辑<转>
- DOMINO中实现PDF在线编辑控件 and so on......(二)
- Office文档在线编辑的实现之二
- [转载]Office文档在线编辑的实现之一
- Office 365实现多人在线编辑同一个文档(中)
- office web apps 整合到自己项目中(wopi实现在线预览编辑)
- Office文档在线编辑的实现之一 转 作者: 周建东 日期: 2007-09-12 03:42
- DOMINO中实现PDF在线编辑控件 and so on......(三)
- webserver和fileserver的分离实现方案以及对fileserver上的office文档实现在线编辑的实现
- DeltaOfficewod在线编辑控件 缺省支持office word 2007
- [转载]Office文档在线编辑的实现之二
- Office 365实现多人在线编辑同一个文档(下)
- DeltaOffice word在线编辑控件增加DisableF12函数,防止通过快捷键保存文档
- 基于DsoFramer控件的Office编辑控件
- Office文档在线编辑的实现之一
- [转]Office文档在线编辑的实现之二
- DeltaOffice word在线编辑控件增加NoCopy禁止拷贝接口
- 通达OA-今日学习:OFFICE文档在线编辑控件与工作流表单手写签章控件的区别是什么?
- 使用微软提供的Office Online实现Office文档的在线查看,编辑等功能
- Office文档在线编辑的实现之一