Although VSTO offers easy ways to save or open password protected Word documents or Excel Workbooks e.g. in pseudocode, Open(docpath, ..., password) or Save(docpath,..., password), it does not offer such options for PowerPoint presentations. However, there is still a way to do it programmatically fairly easily:
To save a presentation with a password:
PowerPoint.Presentation p = Globals.ThisAddIn.Application.Presentations.Add();
p.Password = "whatever";
p.Save();
To open a password protected presentation simply pass the password at the end of the presentation path, when opening it, in this "hackish" way:
PowerPoint.Presentation d = Globals.ThisAddIn.Application.Presentations.Open(FullFilePath + "::whatever::");
To save a presentation with a password:
PowerPoint.Presentation p = Globals.ThisAddIn.Application.Presentations.Add();
p.Password = "whatever";
p.Save();
To open a password protected presentation simply pass the password at the end of the presentation path, when opening it, in this "hackish" way:
PowerPoint.Presentation d = Globals.ThisAddIn.Application.Presentations.Open(FullFilePath + "::whatever::");
No comments:
Post a Comment