• 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);

    
    
    
  • 相关阅读:
    mysql 常用sql操作总结
    c# 安装windows服务
    c# Ajax后台动态分页
    c# SQLHelper总汇
    C#调用Web Service时的身份验证
    c#定时调用作业
    【转】Powerdesigner逆向工程从sql server数据库生成pdm
    aspx页面@Page指令解析
    C# 简单日志文本输出
    【摘抄】C# DateTime.Now详解
  • 原文地址:https://www.cnblogs.com/linsu/p/2307883.html
Copyright © 2020-2023  润新知