C#Microsoft.Office.Interop.PowerPoint幻灯片放映:从此幻灯片开始(Shift + F5)

时间:2018-11-08 19:54:48

标签: c# powerpoint office-addins

我想将开始幻灯片放映实现为C#中的“从此幻灯片开始”(对于Addin)。 键盘快捷键分配为Shift + F5。

以下代码作为开始幻灯片显示为“从头开始”。

// Works as F5 key (start from beginning)
var app = Globals.ThisAddIn.Application;
app.ActivePresentation.SlideShowSettings.Run();

我尝试将SlideShowSettings.StartingSlide与S​​lideShowSettings.RangeType = PpSlideShowRangeType.ppShowSlideRange一起使用,但它限制了幻灯片的范围。 我不能像Shift + F5一样先回到幻灯片。

// NG code: start from 2nd slide and cannot go back to 1st slide
var app = Globals.ThisAddIn.Application;
app.ActivePresentation.SlideShowSettings.RangeType = PpSlideShowRangeType.ppShowSlideRange;
app.ActivePresentation.SlideShowSettings.StartingSlide = 2;
app.ActivePresentation.SlideShowSettings.Run();

我也尝试过SlideShowSettings.RangeType = PpSlideShowRangeType.ppShowAll,但似乎设置冲突。

// NG code: I think it gets conflict. Slide shows does not even start.
var app = Globals.ThisAddIn.Application;
app.ActivePresentation.SlideShowSettings.RangeType = PpSlideShowRangeType.ppShowAll;
app.ActivePresentation.SlideShowSettings.StartingSlide = 2;
app.ActivePresentation.SlideShowSettings.Run();

是否可以通过C#实现Shift + F5? 有什么建议吗?

谢谢。

0 个答案:

没有答案