簡體   English   中英

如何使用PowerPoint.Interop檢查演示文稿的結尾

[英]How to check the presentation end with PowerPoint.Interop

我在帶有ASP.NET的頁面內顯示Powerpoint演示文稿,並且只有“ 下一個”和“ 上一個”按鈕。

我要檢查的是,一旦用戶單擊“ 下一步”按鈕,這是否是演示結束。

這就是我要這樣做的方式:

private void btnNext_Click(object sender, EventArgs e)
    {
        try
        {

            presesntation.SlideShowWindow.View.Next();
            if (presesntation.SlideShowWindow.View.State.Equals(Microsoft.Office.Interop.PowerPoint.PpSlideShowState.ppSlideShowDone))
            {
                if (this.PresentationEnd != null)
                {
                    this.PresentationEnd(this, EventArgs.Empty);
                }

                btnNext.Visible = false;
                btnPrevious.Visible = false;
                foreach (Process proc2 in Process.GetProcessesByName("POWERPNT"))
                {
                    proc2.Kill();
                }
            }
            ///Cria um delay de 1 seg para o proximo clique no botão
            Thread.Sleep(1000);
        }
        catch
        {

        }
    }

檢查演示文稿結束的行是if (presesntation.SlideShowWindow.View.State.Equals(Microsoft.Office.Interop.PowerPoint.PpSlideShowState.ppSlideShowDone))但不適用於某些.ppsx演示文稿。 盡管它適用於每個.pps演示文稿

如何查看演示結束?

您可以讓您的下一個單擊處理程序檢查當前幻燈片的Slide.Index,以查看它是否等於演示文稿Slides.Count。 如果是這樣,您已經在最后一張幻燈片上(即,您在演示文稿的結尾)。

然后,您可以自己結束節目,而不必試圖弄清用戶是否結束了節目。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM