如何在asp.net的浏览器中打开Word文件 [英] how to open word file on browser in asp.net

查看:374
本文介绍了如何在asp.net的浏览器中打开Word文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#在asp.net中的浏览器中打开Word文件,请向我发送详细代码.

How to open word file on browser in asp.net with c# please send me the code in details

推荐答案

protected void Button1_Click(object sender, ImageClickEventArgs e)
    {
        string FullFilePath =//path of file //"D:\\ASP\\ASP.doc";
        FileInfo file = new FileInfo(FullFilePath);
        if (file.Exists)
        {
            Response.ContentType = "application/vnd.ms-word";
            Response.AddHeader("Content-Disposition", "inline; filename=\"" + file.Name + "\"");
            Response.AddHeader("Content-Length", file.Length.ToString());
            Response.TransmitFile(file.FullName);
        }
    }


这篇关于如何在asp.net的浏览器中打开Word文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆