使用 C# 禁用 PowerPoint 功能

发布于 2024-10-07 00:26:54 字数 161 浏览 0 评论 0原文

我的场景: 我的项目有一个要求(C#)。我需要为用户提供仅阅读通过我的应用程序打开的 powerpoint 演示文稿的功能。所有其他功能,如剪切、复制、粘贴、保存、另存为、打印、右键单击上下文菜单应该我如何使用 C# 以编程方式在 powerpoint 中实现此目的?有人可以提供帮助吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

岁月静好 2024-10-14 00:26:54

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

Can you publish the ppt as pps and use that file instead?

梨涡 2024-10-14 00:26:54

只需将每张幻灯片导出为 JPG 或 PNG 并显示它们:Slide.Export。这适用于静态幻灯片视图。如果您想保留 PPT/PPTX 的动画、过渡、视频/音频和导航功能,PowerPoint 到 Flash 转换器是更好的方法。 iSpring 制作了一个免费版本的转换器:www.ispringfree.com。

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.

弃爱 2024-10-14 00:26:54

您应该使用 Powerpoint COM 组件,类似于此处描述的内容......
使用 C# 显示 powerpoint
我只用过Word和Excel,但我必须说它们非常容易使用。

或者您必须将其设置为完全只读,我建议您编写自己的 ODF 解析器,或者研究 ODF COM 组件,也许这也可以工作:)

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 :)

日记撕了你也走了 2024-10-14 00:26:54

一种解决方案可能是使用类似 Aspose .Slides 将幻灯片渲染为 TIFF 或 PDF,然后在应用程序中显示它们。

One solution could be to use something like Aspose.Slides to render the Slides to TIFF or PDF and then display those inside your application.

幽蝶幻影 2024-10-14 00:26:54

如果您的 powerpoint 演示文稿数量较少,您可以查看信息权限管理 或使用权限对象 。 (免责声明:我没有使用过这个)

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)

自控 2024-10-14 00:26:54

假设您正在使用 Powerpoint Automation。获取 PowerPoint.Application 对象,然后循环遍历 CommandBars 属性,并将每个命令栏的 Visible 设置为 false。

这至少应该删除命令栏。应用程序对象上可能还有其他属性可以让您禁用上下文菜单,但我从未真正使用过 powerpoint,所以我不确定是哪些属性。

不过,我认为没有任何好方法可以完全禁用打印等。然而,这篇 MS 知识库文章讨论了一种自动消除任何对话框的黑客方法,因此假设打印/保存等总是会弹出一个对话框(我不确定),您可能可以使用其中的某些内容:< a href="http://support.microsoft.com/kb/259971/en-us?spid=2522&sid=72" rel="nofollow">如何使用 Visual Basic 关闭 Office 应用程序显示的对话框

那篇文章中都是 VB 代码,但思想是相似的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文