日期:2014-05-18  浏览次数:20542 次

如何在客户端打开WORD
我在服务器端生成一个WORD文件
如何让客户端访问这个WORD文件的时候直接用WORD打开?

docWord= "D:\Web\template\doc\ccc.doc ";   //服务器端WORD文件的存放路径
FileStream   fs   =   new   FileStream(docWord,   FileMode.Open,   FileAccess.Read);
                byte[]   bytes   =   new   byte[(int)fs.Length];
                fs.Read(bytes,   0,   bytes.Length);
                fs.Flush();
                fs.Close();
                Response.ContentType   =   "Application/msword ";
                Response.AddHeader( "Content-Disposition ",   "attachment;filename=new.doc ");
                Response.BinaryWrite(bytes);
                Response.Flush();
                Response.Close();    

我是这样写的,以流的方式打开?   但是老是出现这个错误
文件“D:\Web\template\doc\ccc.doc”正由另一进程使用,因此该进程无法访问该文件。  
如果我要是在客户端这个WORD文件能打开吗?我没有测试。高手帮忙。
怎么样让这个WORD文件直接用WORD   2003程序打开?

------解决方案--------------------
http://www.webasp.net/article/15/14577.htm
------解决方案--------------------
http://aspdognet.com/document/2007/01/5312357.html