Dsoframer控件实现office在线编辑

代码 


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" %>



    无标题页

    

    



    
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在线编辑)