MVC如何在html页面显示word文档

 时间:2026-02-12 03:56:44

1、页面 <div class="cont">

            <span class="label">操作手册</span>

            

            <a href="/home/path" class="btn">下载</a>

        </div>

MVC如何在html页面显示word文档

2、HomeController

引用dll

  public ActionResult ViewManual()

        {

            try

            {

              

MVC如何在html页面显示word文档

3、  string virtualURL = ConfigurationManager.AppSettings["ManualPath"].ToString();

                string physicalPath = Server.MapPath(Server.UrlDecode(virtualURL));

                if (string.IsNullOrEmpty(virtualURL) || !System.IO.File.Exists(physicalPath))

                {

                  

MVC如何在html页面显示word文档

4、                string extension = Path.GetExtension(physicalPath);

                string htmlUrl = "";

                switch (extension.ToLower())

                {

                

MVC如何在html页面显示word文档

5、    case ".doc":

                    case ".docx":

                        htmlUrl = PreviewWord(physicalPath, virtualURL);

                        break;

       

        }

MVC如何在html页面显示word文档

  • 君子兰养护方法
  • 如何购买毛绒玩具
  • HALT如何停止机器运行
  • 命运战歌技能书怎么获得
  • 如何烧小龙虾
  • 热门搜索
    冬季祝福语 隔壁老王是什么意思 脚臭怎么办有什么妙招 高歌什么舞 签字笔什么牌子好 内外盘是什么意思 怀才不遇的意思 骊歌的意思 journey是什么意思 树冠是指什么