/// <summary>
 /// Try to open an encrypted, or plaintext file.
 /// </summary>
 /// <param name="file"></param>
 /// <param name="password"></param>
 /// <param name="stream"></param>
 /// <returns>True if file was opened, false otherwise.</returns>
 public static bool TryOpen(String file, String password, out OfficeCryptoStream stream)
 {
     stream = null;
     try
     {
         stream = Open(file, password);
     }
     catch (InvalidPasswordException)
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
        /// <summary>
        /// Try to open an encrypted, or plaintext file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="password"></param>
        /// <param name="stream"></param>
        /// <returns>True if file was opened, false otherwise.</returns>
        public static bool TryOpen(String file, String password, out OfficeCryptoStream stream)
        {
            stream = null;
            try
            {
                stream = Open(file, password);

            }
            catch (InvalidPasswordException)
            {
                return false;
            }
            return true;
        }