asp.net中C#打开并修复word程序

作者:袖梨 2022-06-25
 代码如下 复制代码

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

相关文章

精彩推荐