如何使用 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
演示文稿
如何检查演示文稿结束?
I'm showing a Powerpoint presentation inside a page with ASP.NET and I have only the Next and Previous buttons.
What I would like to check is whether it's the presentation end or not as soon as the user click in Next button.
That's how I'm trying to do this:
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
{
}
}
The line that checks the presentation end is if (presesntation.SlideShowWindow.View.State.Equals(Microsoft.Office.Interop.PowerPoint.PpSlideShowState.ppSlideShowDone))
but it doesn't work with some .ppsx
presentations. Although it works with every .pps
presentation
How do I check the presentation end?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以让下一次单击处理程序检查当前幻灯片的 Slide.Index 以查看它是否等于演示文稿的 Slides.Count。如果是这样,您已经处于最后一张幻灯片上(即,您处于演示文稿的末尾)。
然后,您可以自己结束节目,而不是试图弄清楚用户是否已经结束了节目。
You could have your next click handler check the current slide's Slide.Index to see if it's equal to the presentation Slides.Count. If so, you're already on the last slide (ie, you're at the end of the presentation).
You could then end the show yourself rather than trying to sort out whether the user has ended it.