我使用 NetOffice.PowerPointApi 播放现有 PPTX 的一些 Powerpoint-Slides。这是这样做的:
PowerPoint.Application powerApplication = new PowerPoint.Application();
PowerPoint.Presentation presentation = powerApplication.Presentations.Open("C:\\dev\\test.pptx", MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoTrue);
// presentation.SlideShowSettings.StartingSlide = 2;
presentation.SlideShowSettings.Run();
while (powerApplication.ActivePresentation.SlideShowWindow.View.CurrentShowPosition < 4)
{
System.Threading.Thread.Sleep(2000);
powerApplication.ActivePresentation.SlideShowWindow.View.Next();
}
现在我的计划是展示幻灯片 3 到 4。
但是当我设置startingSlide(在我的示例中注释掉)时,我收到一个错误powerApplication.ActivePresentation.SlideShowWindow.View.CurrentShowPosition
:
{"SlideShowView.CurrentShowPosition : 无效请求。当前没有此演示文稿的幻灯片放映视图。"}
这仅在我设置属性时发生StartingSlide
。如果我不这样做,演示文稿将从第一张幻灯片运行到第四张幻灯片。