zoukankan      html  css  js  c++  java
  • doc文档的web查看

    1.doc文档的查看是这样的需要转换成html,保存路径,直接打开html浏览

    2.应用Microsoft.Office.Interop.Word组件

    3.操作代码

    object filePath = Server.MapPath("doc文件相对路径");
    object readOnly = true;
    object addToRecentFiles = false;
    object confirmConversion = false;
    object revert = true;
    object visible = false;
    object formate = WdSaveFormat.wdFormatFilteredHTML;
    object missing = System.Reflection.Missing.Value;
    object savePath = Server.MapPath("保存目录/"+fileName.Replace("doc的后缀名","html"));
    object saveChanges = false;

    //word引用程序
    Application word = new Application();
    //打开一个文档
    Document doc = word.Documents.Open(ref filePath,
    ref confirmConversion, ref readOnly, ref addToRecentFiles, ref missing, ref missing, ref revert, ref missing, ref missing, ref missing, ref missing,
    ref visible, ref missing, ref missing, ref missing, ref missing);
    //另存为网页格式
    doc.SaveAs(ref savePath, ref formate, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
    word.Quit(ref saveChanges, ref missing, ref missing);

    
    
    
  • 相关阅读:
    ps怎么撤销的三种方法和ps撤销快捷键以及连续撤销多步快捷键
    jquery data()
    jQuery.extend方法
    Bootstrap
    骚操作
    mysql作业
    jQuery UI练习
    左侧菜单,表格,认证登录作业
    JS
    js中的DOM操作汇总
  • 原文地址:https://www.cnblogs.com/linsu/p/2307883.html
Copyright © 2011-2022 走看看