public void GotoPage(int page) { if (pageTotal < page) { page = pageTotal; } try { PPT.SlideShowView ssv = objPresSet.SlideShowWindow.View; int currentShowPosition = objPresSet.SlideShowWindow.View.CurrentShowPosition; ssv.GotoSlide(page); int currentShowPosition2 = objPresSet.SlideShowWindow.View.CurrentShowPosition; //int clickcount2 = objPresSet.SlideShowWindow.View.GetClickCount(); //int clickindex2 = objPresSet.SlideShowWindow.View.GetClickIndex(); int a = 0; a++; if (currentShowPosition2 != page) { Thread.Sleep(1000); ssv.GotoSlide(page); currentShowPosition2 = objPresSet.SlideShowWindow.View.CurrentShowPosition; } pageCurrent = currentShowPosition2; GetCurrentPage(); } catch (Exception e) { Log.Error("GotoPage excepton: " + e.Message); } }
public void gotoSlide(int addcount) { try { if (Globals.ThisAddIn.Application.ActiveWindow.Active == Office.MsoTriState.msoTrue) { PowerPoint.View view = Globals.ThisAddIn.Application.ActiveWindow.View; PowerPoint.Presentation presentation = Globals.ThisAddIn.Application.ActivePresentation; PowerPoint.Slide slide = (PowerPoint.Slide)view.Slide; if (slide.SlideIndex + addcount > 0 && addcount <= presentation.Slides.Count) { view.GotoSlide(slide.SlideIndex + addcount); } } } catch (Exception) { // throw; } try { if (Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.Active == Office.MsoTriState.msoTrue) { PowerPoint.SlideShowView view = Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.View; PowerPoint.Presentation presentation = Globals.ThisAddIn.Application.ActivePresentation; PowerPoint.Slide slide = (PowerPoint.Slide)view.Slide; if (slide.SlideIndex + addcount > 0 && addcount <= presentation.Slides.Count) { view.GotoSlide(slide.SlideIndex + addcount); } } } catch (Exception) { // throw; } }