none
Supprimer le mot de passe de document word RRS feed

Réponses

  • j'ai fait quelques modifications au niveau de mon code comme suit : 

       Word.Application word = new Word.Application();
    
                             object isVisible = false;
                             object nullobj = System.Reflection.Missing.Value;
                             string pass = passw;
                             object password = pass;
                             object FName = sFileName;
                             Microsoft.Office.Interop.Word.Document aDoc = null;
                             word.Visible = false;
                             aDoc = word.Documents.Open(ref FName, ref nullobj, ref nullobj, ref nullobj, ref password, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
                             aDoc.Activate();
                             if (aDoc.HasPassword)
                                 aDoc.Password = null;
    
                             if (aDoc.ProtectionType != WdProtectionType.wdNoProtection)
                                 aDoc.Unprotect(ref password);
                             aDoc.Final = true;//Notice!!
                             aDoc.SaveAs(ref FName, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
    
                             word.Documents.Close();

    • Marqué comme réponse Aurel Bera vendredi 26 juillet 2013 08:54
    vendredi 26 juillet 2013 08:53

Toutes les réponses