我有一个Power Point幻灯片放映,我在C#中访问。它打开并出现在屏幕上,我可以手动单步执行它,但它已经在动画选项卡中有时间。如何根据powerpoint中动画中的设置启动节目并运行?
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();
答案 0 :(得分:1)
事实证明我只需要一行来激活动画时间。
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();