【问题标题】:Navigate to a particular slide in PowerPoint Add-In导航到 PowerPoint 加载项中的特定幻灯片
【发布时间】:2017-03-23 21:49:01
【问题描述】:

使用以下代码,我设法跳转到 SlideShow-View using code from this question 中的特定幻灯片:

Microsoft.Office.Interop.PowerPoint.Presentation objPres;
Microsoft.Office.Interop.PowerPoint.SlideShowView objSlideShowView;

objPres = Globals.ThisAddIn.Application.ActivePresentation;
objPres.SlideShowSettings.ShowPresenterView = MsoTriState.msoFalse;
objPres.SlideShowSettings.Run();
objSlideShowView = objPres.SlideShowWindow.View;                

int index = Int32.Parse(clickedIssue.ToolTip.ToString());               

objSlideShowView.GotoSlide(index);

但我真正想要的是它跳转到普通视图中的特定幻灯片。我知道我可以使用 Globals.ThisAddIn.Application.ActiveWindow.Application.ActiveWindow.View.Slide 获取当前选定的幻灯片,但是如何使用代码更改其引用?

【问题讨论】:

    标签: c# vsto powerpoint add-in


    【解决方案1】:

    强烈推荐使用

    int SlideIndex = 3;
    try
    {
      Globals.YourAddin.Application.ActiveWindow.View.GotoSlide(SlideIndex);
    }
    catch { }
    

    .Select() 给我带来了奇怪的问题,PowerPoint 降低了它的性能..

    【讨论】:

    • 同意GoToSlide(),如果您想更改活动幻灯片而不影响对插件 UI 控件的关注,这绝对是您的选择。 Slide.Select() 给我带来了问题,因为我的控件没有进入编辑模式,当从控件的事件处理程序中选择()幻灯片时,引入了“需要双击”行为。
    【解决方案2】:

    使用以下代码解决了它:

    Microsoft.Office.Interop.PowerPoint.Presentation objPres;
    int index = Int32.Parse(clickedIssue.ToolTip.ToString());
    
    objPres = Globals.ThisAddIn.Application.ActivePresentation;
    var slides = objPres.Slides;
    
    slides[index].Select();
    

    the code from this answer相同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-24
      • 2020-08-31
      • 2021-01-21
      • 2017-07-18
      • 2012-09-14
      • 1970-01-01
      • 2017-08-11
      • 1970-01-01
      相关资源
      最近更新 更多