I am trying to open a protected excel(xlsx) file to check, is it password protected or corrupted. but on open it asked for password prompt. Is any way to pass Ok on asking password.This issue is only with xlsx but not xls file.
Asked
Active
Viewed 1,080 times
-5
-
Why did you select c# tag? – DerApe Dec 10 '14 at 08:00
-
Because i am opening file using C# code. – Nakul Chaudhary Dec 10 '14 at 08:03
-
Wait, do you want to ignore the password protection and open the excel file anyway? – L-Four Dec 10 '14 at 08:08
-
No i just want to known file is password protected or corrupted but in case it is already open than on open it prompt for password and if not open than not asked to password just give exception. – Nakul Chaudhary Dec 10 '14 at 08:19
-
like http://stackoverflow.com/questions/1943881/how-to-check-excel-workbook-or-sheet-is-password-protected-or-not or http://stackoverflow.com/questions/5778074/detecting-a-password-protected-document? – L-Four Dec 10 '14 at 08:22
-
Whoa just seen your rep and number of years in SO...you should really know how to construct a question by now... Your question besides from being worded incorrectly lacks the codes that you have done so far. – TheProvost Dec 11 '14 at 00:27
1 Answers
1
I was going to flag this as out of topic but seeing you have a c# tag did you mean check it programmatically? if so checking if a file has a password is as easy as this...
Excel.Workbook yourWorkBookObject = ;
if (yourWorkBookObject.HasPassword)
{
}

TheProvost
- 1,832
- 2
- 16
- 41