首页 > Web开发 > 详细

Aspose.Words 直接写response导出docx文档显示文件已损坏需要修复的解决办法

时间:2015-09-17 00:48:55      阅读:1303      评论:0      收藏:0      [点我收藏+]

使用Aspose.Words的Document.Save(HttpResponse response, string fileName, ContentDisposition contentDisposition, Aspose.Words.Saving.SaveOption saveOption)方法,将Document直接写入response时,需要加Response.End();

Document doc = new Document(postedFile.InputStream);
doc.Save(Response, dstFileName, ContentDisposition.Inline, SaveOptions.CreateSaveOptions(dstFormat));
// Required. Otherwise DOCX cannot be opened on the client (probably not all data sent
 // or some extra data sent in the response).
Response.End();

请注意注释部分!!

 

Aspose.Words 直接写response导出docx文档显示文件已损坏需要修复的解决办法

原文:http://www.cnblogs.com/drsniper/p/4814961.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!