简体   繁体   中英

Disable PowerPoint features using C#

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 featues like cut,copy,paste,save,saveas,print,right click context menus should be disabled.How can i achieve this in powerpoint programatically using c#? can anyone extend their help?

Just export each slide as a JPG or PNG and display those: Slide.Export . This would be for static slide views. If you want to retain animations, transitions, video/audio and navigation features for your PPT/PPTX, a PowerPoint-to-Flash converter is a better way to do this. iSpring makes a free version of their converter: www.ispringfree.com.

您可以将ppt发布为pps并使用该文件吗?

You should use the Powerpoint COM component, kind of like whats described here... Using C# to display powerpoint I have only used Word and Excel ones, and i must say they are extremely easy to use.

Or is you MUST make it completely read-only, id suggest writing your own ODF parser, or investigating in the ODF COM component, maybe that could work as well :)

If you have a low number of powerpoint presentations, you can look into Information Rights Management or use the Permissions Object . (Disclaimer:I have not used this)

一种解决方案是使用Aspose.Slides之类的东西将幻灯片呈现为TIFF或PDF,然后在应用程序内部显示它们。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM