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

© 2026 途途旅游
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com