使用listview下载存储在数据库中的MS word文档 [英] Downloading MS word document stored in database using listview
本文介绍了使用listview下载存储在数据库中的MS word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生,
我有一些word文档存储在数据库中,我想点击列表视图链接按钮下载文件。
请发送代码
谢谢
Dear Sir,
I have some word documents stored in database,I want to download the document on click of list view link button.
Please send the code
Thank you
推荐答案
我猜你没有在网上搜索这个,这是一个常见的任务,我相信你可以找到成千上万的演示样本。
这是另外一个:
I guess you haven't search the web for this, it is such a common task that I believe you can find literally thousands of demonstration samples.
Here is one more:
// Retrieve the file's content from your database.
byte[] fileBytes = ...
string fileName = "Download.docx";
this.Response.ClearContent();
// Use appropriate content type:
// DOC = 'application/msword'
// DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
// ...
this.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
this.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
this.Response.OutputStream.Write(fileBytes, 0, fileBytes.Length);
this.Response.End();
这篇关于使用listview下载存储在数据库中的MS word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文