C# 如何以编程方式在SlideMaster和默认视图之间切换?
我需要在SlideMaster模式下通过单击按钮切换选定的主父幻灯片。 此外,我还需要返回默认模式,并在此模式幻灯片中选择“上次选定” 有人知道怎么做吗(PP2007/PP2010/PP2013)C# 如何以编程方式在SlideMaster和默认视图之间切换?,c#,vsto,powerpoint,C#,Vsto,Powerpoint,我需要在SlideMaster模式下通过单击按钮切换选定的主父幻灯片。 此外,我还需要返回默认模式,并在此模式幻灯片中选择“上次选定” 有人知道怎么做吗(PP2007/PP2010/PP2013) 谢谢我会在VBA中这样做: Sub Switch_To_Slidemaster() Dim curSLD As Long curSLD = ActiveWindow.View.Slide.SlideIndex 'switch to SlideMaster Application.Windo
谢谢我会在VBA中这样做:
Sub Switch_To_Slidemaster()
Dim curSLD As Long
curSLD = ActiveWindow.View.Slide.SlideIndex
'switch to SlideMaster
Application.Windows(1).ViewType = ppViewSlideMaster
'return to default
Application.Windows(1).ViewType = ppViewNormal
'set slide
ActiveWindow.Presentation.Slides(curSLD).Select
End Sub
我希望你能适应转变。
(针对PP 2010进行了测试)我已经在PP2007、PP2010、PP2013中测试了这段代码,它可以正常工作
private int _slideIndexInDefaultView;
private void ButtonNormalView_Click(object sender, RibbonControlEventArgs e)
{
// Default view
Globals.AddIn.Application.Windows[1].ViewType = Microsoft.Office.Interop.PowerPoint.PpViewType.ppViewNormal;
Globals.AddIn.Application.ActiveWindow.Presentation.Slides[_slideIndexInDefaultView].Select();
}
private void ButtonSlideMasterView_Click(object sender, RibbonControlEventArgs e)
{
// Slide master view
_slideIndexInDefaultView = Globals.AddIn.Application.ActiveWindow.View.Slide.SlideIndex;
Globals.AddIn.Application.Windows[1].ViewType = Microsoft.Office.Interop.PowerPoint.PpViewType.ppViewSlideMaster;
}
清楚的VBA代码(不是C#)对你有帮助吗?好的。给我VBA。如果可行的话,我会试着翻译成C。