c# - 如何以编程方式将 powerpoint View 类型更改为阅读 View ?

标签 c# vba powerpoint office-interop office-2010

Powerpoint 2010 中引入了一种新的 View 类型,称为“阅读 View ”。我正在尝试将它应用于演示文稿,但办公室互操作的 PpViewType 枚举不包含任何将演示文稿 View 修改为“阅读 View ”的成员。任何人都可以帮助我它是否已在其他地方定义或我如何以编程方式更改为阅读 View ?

PowerPoint.Application oPPT = new PowerPoint.Application();

//Add New Presentation
PowerPoint.Presentations oPresSet = oPPT.Presentations;
PowerPoint.Presentation oPres = oPresSet.Add(Office.MsoTriState.msoTrue);

//Add Slides to the Presentation
PowerPoint.Slides oSlides = oPres.Slides;
PowerPoint.Slide oSlide = oSlides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
oSlide.Shapes[1].TextFrame.TextRange.Text ="sample text";

//Changing View Type
oPres.Application.ActiveWindow.ViewType = PowerPoint.PpViewType.ppViewNotesPage;

最佳答案

您似乎无法直接从对象模型切换到阅读 View ,但您可以将其近似用于 Office 2010+ 中的只读演示文稿文件:

  • 使用 ppShowTypeWindow2 的 ShowType 开始幻灯片放映。
  • 关闭原来的DocumentWindow
  • 将演示文稿标记为已保存。

VBA 示例

Dim pres As Presentation
Dim settings As SlideShowSettings

Set pres = ActivePresentation
Set settings = pres.SlideShowSettings

settings.ShowType = ppShowTypeWindow2
settings.Run

pres.Windows(1).Close
pres.Saved = msoTrue

关于c# - 如何以编程方式将 powerpoint View 类型更改为阅读 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9061103/

相关文章:

c# - 控制台应用程序中的 Application.Current "null"

vba - 可旋转的困境

vba - ReDim 保留错误

excel - 动态 Excel VBA 代码更改文本框大小

python - 使用 python-pptx 创建 PPT 时如何使用我公司的 PPT 幻灯片布局?

c# - 折叠行时动态调整数据网格列的大小

c# - log4net BufferingForwardingAppender 性能问题

C#数字键决定三个数组操作中的哪一个

excel - 运行时的对象属性

vba - 使用 3 个小数点从 Excel 更新 PowerPoint