C#控制Word打开文档后,如何设置文档不可编辑

来源:互联网 发布:centos7删除ssh22端口 编辑:程序博客网 时间:2024/05/01 20:24

if(ThisApplication.ActiveDocument.ProtectionType==WdProtectionType.wdAllowOnlyComments)  
  {  
  ThisApplication.ActiveDocument.Unprotect(ref   Password);  
  }  
   
   
  if(ThisApplication.ActiveDocument.ProtectionType==WdProtectionType.wdNoProtection)  
  {  
  ThisApplication.ActiveDocument.Protect(WdProtectionType.wdAllowOnlyComments,ref   NoResrt   ,ref   Password);  
  }

原创粉丝点击