Disable PowerPoint features using C#

前端 未结 6 1726
抹茶落季
抹茶落季 2021-01-27 06:36

My scenario: I have a requirement in my project(C#).I need to give the user only reading capability for my powerpoint presentation opened thru my application.All other

6条回答
  •  暖寄归人
    2021-01-27 06:51

    Assuming that you're using Powerpoint Automation. Get hold of the PowerPoint.Application object and then loop through the CommandBars property and for each command bar, set Visible to false.

    This should remove the command bars at least. And there might be other properties on the Application object that lets you disable context menus, but I've never really used powerpoint, so I'm not sure which ones.

    I don't think that there's any good way of disabling printing etc altogether though. However, this MS KB article discusses a hacky way of dismissing any dialogs automatically, so assuming that the print/save etc would always bring up a dialog (which I'm not sure off) you might be able to use something from there: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic

    It's all VB code in that article, but the ideas will be similar.

提交回复
热议问题