连续循环显示PowerPoint演示文稿

问题描述:

我想连续循环播放一些ppt文件,但是当第一个文件到达最后一张幻灯片后打开新文件时,会打开一个新的PowerPoint窗口并启动幻灯片。 我该如何解决这个问题?连续循环显示PowerPoint演示文稿

 public Microsoft.Office.Interop.PowerPoint.SlideShowWindow startppt(string pptDatei) 
    { 
     WatchingLabel.Text = "Präsentation läuft..."; 
     started = true; 
     ende = false; 
     objPres = ppApp.Presentations.Open(pptDatei, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue); 

     objPres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue; 
     presWin = objPres.SlideShowSettings.Run(); 

     return presWin; 
    } 

    private void timer1_Tick(object sender, EventArgs e) 
    { 
     WatchingLabel.Text = "Watching..."; 

     if (System.IO.Directory.Exists(ordner)) 
     { 
      pptDatei.Clear(); 
      pptDatei.AddRange(System.IO.Directory.GetFiles(ordner, "*.ppt")); 

      if (started == true && presWin.View.State == Microsoft.Office.Interop.PowerPoint.PpSlideShowState.ppSlideShowDone) 
      { 
       objPres.Close(); 
       ende = true; 
       started = false; 
      } 

      if (pptDatei.Count > 0 && ende && started == false) 
      { 
       if (index < pptDatei.Count) 
       { 
        startppt(pptDatei[index]); 
        index += 1; 
       } 
       else 
       { 
        index = 0; 
       } 
      } 
      else if (pptDatei.Count > 0 && ende == false && started == true) 
      { 
       presWin.View.Next(); 
      } 

     } 
    } 

    public void ppApp_PresentationClose(Microsoft.Office.Interop.PowerPoint.Presentation Pres) 
    { 
     pptDatei = new List<string>(); 
     started = false; 
     ende = true; 
     WatchingLabel.Text = "Präsentation beenden..."; 
    } 

    public void ppApp_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres) 
    { 
     ende = true; 
     started = false; 
    } 
+0

@ user589216:只想跟进以查看下方是否回答您的问题 – 2011-04-05 20:51:17

不幸的是,你不能用多个PowerPoint文件做到这一点。在PowerPoint 2010之前,您不能同时运行多个PPT(即使使用PP2010,也不会这么做)。所以通过关闭一个并打开一个新的运行窗口,您将失去主窗口。

您可以创建多个PowerPoint实例,将它们设置为可见/隐藏,然后当一个幻灯片结束时,以编程方式取消隐藏下一个幻灯片并显示它运行,但这会遭受与您已有的相同闪烁问题。

你可以做的最好的办法是读取目录中的所有ppts,按照你需要的顺序将它们全部合并到一个新的卡组中(然后指定布局等),然后在kiosk-loop中运行该卡组。