简体   繁体   English

如何从LinkBut​​ton单击读取PDF,Word和Excel文件? + Asp.Net + C#

[英]How to read a PDF,Word and Excel files from LinkButton click ? + Asp.Net + C#

How to read a PDF , Word and Excel files from LinkButton click ? 如何从LinkBut​​ton单击读取PDFWordExcel文件? + Asp.Net + C# . + Asp.Net + C#

This is my code : 这是我的代码:

protected void LinkButton155_Click(object sender, EventArgs e)
{
    Response.Clear();
    Response.ContentType = "application/vnd.msword"; 
    Response.AppendHeader("content-disposition", "attachment; filename=" + "C:\\inetpub\\wwwroot\\suppression des doublons.docx");
    Response.Flush();
    Response.WriteFile("C:\\inetpub\\wwwroot\\suppression des doublons.docx");


}

For Excel Files: 对于Excel文件:

protected void LinkButton153_Click1(object sender, EventArgs e)
{
    Response.Clear();
    Response.ContentType = "application/vnd.ms-excel";
    Response.AppendHeader("content-disposition", "attachment; filename=" + "C:\\inetpub\\wwwroot\\decret.xlsx");
    Response.Flush();
    Response.WriteFile("C:\\inetpub\\wwwroot\\decret.xlsx");       
}

For PDF Files : 对于PDF文件:

protected void LinkButton154_Click(object sender, EventArgs e)
{

    Response.ContentType = "Application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=Acces_aux_marches.pdf");
    Response.TransmitFile(Server.MapPath("~/App_Data/Accès aux marchés/Acces_aux_marches.pdf"));
    Response.End();


}
protected void LinkButton155_Click(object sender, EventArgs e)
{
    Response.Clear();
    Response.ContentType = "application/vnd.msword"; 
    Response.AppendHeader("content-disposition", "attachment; filename=" + "C:\\inetpub\\wwwroot\\decret.docx");
    Response.Flush();
    Response.WriteFile("C:\\inetpub\\wwwroot\\decret.docx");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 LinkButton InnerHTML 从 C# 更改为 asp.net? - How to change LinkButton InnerHTML from C# asp.net? 如何通过单击另一页面的链接按钮来调用按钮的单击事件,而无需在c#ASP.NET中回发 - How to call button's click event from click of linkbutton of another page without post back in c# ASP.NET 如何在LinkBut​​ton单击时将字符串传递给ASP.Net中的单击事件? C# - How do I pass a string to an click event in ASP.Net on a LinkButton click? C# 如何使用c#asp.net在LinkBut​​ton的click事件中获取gridview的DataKeyNames值 - How to get DataKeyNames value of gridview inside LinkButton's click event using c# asp.net 使用C#ASP.NET从页面加载的数据列表访问链接按钮 - Access linkbutton from datalist on pageload with c# asp.net 如何在ASP.Net C#中使用ModalPopupExtender连接GridView中的LinkBut​​ton? - How to hookup the LinkButton in a GridView with a ModalPopupExtender in ASP.Net C#? 如何显示要由用户ASP.NET C#下载的Word,Excel和PowerPoint等文件 - How to present files like Word, Excel and PowerPoint to be downloaded by the user ASP.NET C# 如何使用/不使用ASP.net C#中的CodeBehind将DropDownList中的SelectedValue作为查询字符串传递给LinkBut​​ton - How to pass the SelectedValue from a DropDownList as a query string in a LinkButton with/without using CodeBehind in ASP.net C# 在浏览器中显示word / pdf / excel等文件。 (Asp.net,C#.net 2008) - Display word/pdf/excel etc. files in browser. (Asp.net , C#.net 2008) 如何使用C#ASP.NET与Excel文件进​​行交互 - How to interact with Excel files using C# ASP.NET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM