none
Supprimer le mot de passe de document word

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();

    vendredi 26 juillet 2013 08:53

Toutes les réponses