推进Powerpoint幻灯片显示动画自动跟随定时

本文关键字:跟随 定时 动画 Powerpoint 幻灯片 显示 推进 | 更新日期: 2023-09-27 18:06:01

我有一个用c#访问的幻灯片。它打开并出现在屏幕上,我可以手动通过它,但它已经在动画选项卡上有计时功能。我怎样才能根据幻灯片中的动画设置来启动并运行这个节目呢?

Microsoft.Office.Interop.PowerPoint.Application app = null;
Microsoft.Office.Interop.PowerPoint.Presentation pres = null;
app = new Microsoft.Office.Interop.PowerPoint.Application();
app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide);
pres = app.Presentations.Open(filename,
                Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
//I was hoping this line would just run my show with the timings but it does not.
pres.SlideShowSettings.Run();
pres.SlideShowWindow.View.First();

手动推进,我一直在做

pres.SlideShowWindow.View.Next();

推进Powerpoint幻灯片显示动画自动跟随定时

我只需要再多一行来激活动画计时。

pres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue; 

完整代码

Microsoft.Office.Interop.PowerPoint.Application app = null;
Microsoft.Office.Interop.PowerPoint.Presentation pres = null;
app = new Microsoft.Office.Interop.PowerPoint.Application();
app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide);
pres = app.Presentations.Open(filename,
            Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
pres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue;
pres.SlideShowSettings.Run();
pres.SlideShowWindow.View.First();