我正在尝试使用C#加载项来控制PowerPoint当前幻灯片(从IR遥控器双向滑动),但是我被卡在了Power Point加载项的编程部分
如此简单,即时通讯有一个无限循环,等待后台线程上的串行命令(完成此部分),但即时通讯卡住了如何更改当前显示的幻灯片
我正在使用Office加载项-> Power Point 2013加载项
如何更改当前显示的幻灯片?
Microsoft.Office.Interop.PowerPoint.Application objPPT;
Microsoft.Office.Interop.PowerPoint.Presentations objPresentations;
Microsoft.Office.Interop.PowerPoint.Presentation objCurrentPresentation;
Microsoft.Office.Interop.PowerPoint.SlideShowView objSlideShowView;
private void StartPowerPointPresentation(object sender, EventArgs e)
{
// Open an instance of PowerPoint and make it visible to the user
objPPT = new Microsoft.Office.Interop.PowerPoint.Application();
objPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
//Open a presentation
OpenFileDialog openDlg = new OpenFileDialog();
openDlg.Filter = "Powerpoint|*.ppt;*.pptx|All files|*.*";
if (opendlg.ShowDialog() == true)
{
//Open the presentation
objPresentations = objPPT.Presentations;
objCurrentPresentation = objPresentations.Open(openDlg.FileName, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
//Hide the Presenter View
objCurrentPresentation.SlideShowSettings.ShowPresenterView = MsoTriState.msoFalse;
//Run the presentation
objCurrentPresentation.SlideShowSettings.Run();
//Hold a reference to the SlideShowWindow
objSlideShowView = objCurrentPresentation.SlideShowWindow.View;
}
}
private void ShowNextSlide(object sender, EventArgs e)
{
//Unless running on a timer you have to activate the SlideShowWindow before showing the next slide
objSlideShowView.Application.SlideShowWindows[1].Activate();
//Go to next slide
objSlideShowView.Next();
}
这在AddIn中应该很容易实现,您可能必须在StartUp事件中连接一些事件,然后按照此示例说明如何使用对象模型显示下一张幻灯片。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句