简体   繁体   English

使用C#禁用PowerPoint功能

[英]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#? 我的场景:我的项目(C#)中有一个需求。我需要为用户提供仅通过我的应用程序打开的PowerPoint演示文稿的阅读功能。所有其他功能,如剪切,复制,粘贴,保存,saveas,打印,右键单击应该禁用上下文菜单。如何在Powerpoint中使用C#以编程方式实现此功能? can anyone extend their help? 谁能提供帮助?

Just export each slide as a JPG or PNG and display those: Slide.Export . 只需将每个幻灯片导出为JPG或PNG并显示它们即可: 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. 如果要为PPT / PPTX保留动画,转场,视频/音频和导航功能,PowerPoint到Flash转换器是一种更好的方法。 iSpring makes a free version of their converter: www.ispringfree.com. iSpring免费提供其转换器的免费版本: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. 您应该使用Powerpoint COM组件,有点像这里描述的内容。 使用C#显示 Powerpoint我只使用过Word和Excel,我必须说它们非常易于使用。

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 :) 还是您必须将其完全设为只读,id建议编写您自己的ODF解析器,或研究ODF COM组件,也许这也可以工作:)

If you have a low number of powerpoint presentations, you can look into Information Rights Management or use the Permissions Object . 如果PowerPoint演示文稿的数量较少,则可以查看“ 信息权限管理”或使用“ 权限对象” (Disclaimer:I have not used this) (免责声明:我没有使用过)

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

Assuming that you're using Powerpoint Automation. 假设您正在使用Powerpoint自动化。 Get hold of the PowerPoint.Application object and then loop through the CommandBars property and for each command bar, set Visible to false. 掌握PowerPoint.Application对象,然后遍历CommandBars属性,并为每个命令栏将Visible设置为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. 而且在Application对象上可能还有其他属性可以让您禁用上下文菜单,但是我从来没有真正使用过powerpoint,所以我不确定哪个。

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 然而,这个MS KB文章讨论会自动解雇任何对话框的哈克的方式,所以假设打印/保存等总是会弹出一个对话框(这我不知道关闭),你也许能够使用的东西从那里: 如何消除使用Visual Basic的Office应用程序显示的对话框

It's all VB code in that article, but the ideas will be similar. 那是这篇文章中的所有VB代码,但是想法是相似的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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