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如何停止机器运行
  • 命运战歌技能书怎么获得
  • 如何烧小龙虾
  • 热门搜索
    辞职后社保怎么办 垃圾桶用英文怎么说 万和燃气灶怎么样 两边太阳胀痛怎么回事 吉林师范大学怎么样 白云山旅游攻略 北京奔驰怎么样 约伴旅游网 盘锦旅游 长沙旅游团