页面文件预览,在线等

程序员-阿勇 程序员-阿勇 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
需求:有一个word,想将他显示在一个新的页面中。
现有代码:
string strFilename = "C:\\Users\\admin\\Desktop\\aa.doc";
System.IO.FileInfo DownloadFile = new System.IO.FileInfo(strFilename);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = true;
Response.Charset = "utf-8";
Response.ContentType = "application/msword";
Response.AppendHeader("Content-Disposition",
"Attachment;FileName=" +
HttpUtility.UrlEncode("qqq.doc", Encoding.UTF8));
Response.ContentEncoding = Encoding.UTF8;
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());

Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
结果成了下载了!我不是要下载下来 是要到新的页面将word里面的东西显示出来!
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
程序员-阿勇
.NET社区 62,271 成员 668,968 内容