C# 导航到PowerPoint加载项中的特定幻灯片

C# 导航到PowerPoint加载项中的特定幻灯片,c#,vsto,powerpoint,add-in,C#,Vsto,Powerpoint,Add In,使用以下代码,我成功地跳转到幻灯片视图中的特定幻灯片: Microsoft.Office.Interop.PowerPoint.Presentation objPres; int index = Int32.Parse(clickedIssue.ToolTip.ToString()); objPres = Globals.ThisAddIn.Application.ActivePresentation; var slides = objPres.Slides; slides[index].S

使用以下代码,我成功地跳转到幻灯片视图中的特定幻灯片:

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();

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

使用此代码解决了此问题:

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();

与相同。

我强烈建议使用

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();
int SlideIndex = 3;
try
{
  Globals.YourAddin.Application.ActiveWindow.View.GotoSlide(SlideIndex);
}
catch { }
.Select()给我带来了一些奇怪的问题,PowerPoint降低了它的性能。

同意
GoToSlide()
,如果您想更改活动幻灯片而不影响对加载项UI控件的关注,这绝对是一种方法
Slide.Select()
导致我的控件未进入编辑模式,在从控件的事件处理程序中选择幻灯片()时引入了“双击所需”行为。
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();