Whenever I am trying to open the password protected 2007 ppt or excel,
through code it is prompting to enter the password and application become
visible to the user, which is not intended behavior.
If same code is tried on the machine which has office 2007 installed, files
open correctly without prompting to enter the password and in invisible mode,
which is the intended behavior.
We are using ref to Microsoft.Office.Interop.Excel11.0 library to open the
file and fallowing C# code
Excel.Application _excelApp = null;
Excel.Workbook _book = null;
object readOnly = true;
object updateLinks = 2;
object _dontCare = Type.Missing;
object ignoreReadOnly = true;
object notify = false;
_excelApp = new Excel.Application();
_excelApp.Visible = true;
_excelApp.DisplayAlerts = false;
_excelApp.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
_book = _excelApp.Workbooks.Open(@"C:\test.xlsx",
updateLinks,
readOnly,
_dontCare,
"test",
_dontCare,
ignoreReadOnly,
_dontCare,
_dontCare,
_dontCare,
notify,
_dontCare,
_dontCare,
_dontCare,
_dontCare);
Please let us know if you have any solution for this.
same behavior is identified for the powerpoint2007 files also.
but simmilar issue work fine with password protected office2007 word
file(.docx) on office 2003 machine.
My machine has .net PIA installed and also office 2007 file convector.
Did you ever manage to find out how to open password protected XLS files
without showing any dialog box ?
Thanks,
Filippo