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

2025-11-08 16:37:57

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文档

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
  • 阅读量:77
  • 阅读量:73
  • 阅读量:131
  • 阅读量:188
  • 阅读量:152
  • 猜你喜欢