zoukankan      html  css  js  c++  java
  • C#打开并修复word实现方法

    C#打开并修复word实现方法

    C#操作打开损坏的word时候,可以采用如何方法进行打开,如下:

    objDocLast = objApp.Documents.Open(
      ref objOrgDoc, //文件名
      ref objMissing, //确认版本
      ref objMissing, //只读
      ref objMissing, //添加到最近的文件
      ref objMissing, //密码文件
      ref objMissing, //密码摸板
      ref objMissing, //回复
      ref objMissing, //写密码文件
      ref objMissing, //写密码摸板
      ref objMissing, //格式
      ref objMissing, //加密
      ref objMissing, //可视
      ref objMissing, //打开并修复
      ref objMissing, //直接文党
      ref objMissing, //没加密的对话框
      ref objMissing //XML传输
      );
     
    #region - 打开并修复文档 -
     
    public static bool OpenAndRepair(string filePath, bool isVisible)
     
    {
     
    try
     
    {
     
    oWord = new Microsoft.Office.Interop.Word.Application();
     
    oWord.Visible = isVisible;
     
    object path = filePath;
     
    oDoc = oWord.Documents.Open(ref path,
     
    ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,
     
    ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,
     
    ref Nothing, true, ref Nothing, ref Nothing, ref Nothing);
     
    return true;
     
    }
     
    catch (Exception)
     
    {
     
    return false;
     
    }
     
    }
     
    #endregion
  • 相关阅读:
    石子合并之一
    最长公共子序列
    最长上升子序列
    剑圣的逃跑
    方格取数
    数字三角形
    Omkar and Last Class of Math
    IDEA中对代码进行测试
    Spark(一)【spark-3.0安装和入门】
    HTTP请求 Java API
  • 原文地址:https://www.cnblogs.com/love007/p/2444226.html
Copyright © 2011-2022 走看看