一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

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

时间:2022-06-25 08:22:52 编辑:袖梨 来源:一聚教程网

 代码如下 复制代码

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

热门栏目