I'd like to be able to advance through a Powerpoint presentation by pressing buttons in a Windows form. Here's some code I've found from http://bytes.com/topic/c-sharp/answers/272940-open-powerpoint-presentation-c-window-form that opens a Powerpoint presentation slide show:
我希望能够通过按Windows窗体中的按钮来推进Powerpoint演示。以下是我从http://bytes.com/topic/c-sharp/answers/272940-open-powerpoint-presentation-c-window-form中找到的一些代码,它打开了一个Powerpoint演示幻灯片:
Microsoft.Office.Interop.PowerPoint.Application oPPT;
Microsoft.Office.Interop.PowerPoint.Presentations objPresSet;
Microsoft.Office.Interop.PowerPoint.Presentation objPres;
//the location of your powerpoint presentation
string strPres = @"filepath";
//Create an instance of PowerPoint.
oPPT = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
// Show PowerPoint to the user.
oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
objPresSet = oPPT.Presentations;
//open the presentation
objPres = objPresSet.Open(strPres, MsoTriState.msoFalse,
MsoTriState.msoTrue, MsoTriState.msoTrue);
objPres.SlideShowSettings.Run();
I haven't found any methods that can advance through the slides, however. Any ideas?
但是,我没有找到任何可以通过幻灯片前进的方法。有任何想法吗?
(Really what I'm trying to do is use the WiiRemote to advance the slides, for a student project).
(我真正想做的是使用WiiRemote推进幻灯片,为学生项目)。
4 个解决方案
#1
10
The method to advance programatically is "SlideShowWindow.View.Next". You can also use "SlideShowWindow.View.Previous" to go backwards.
以编程方式推进的方法是“SlideShowWindow.View.Next”。您也可以使用“SlideShowWindow.View.Previous”向后退。
#2
3
Looks like there is a method called GotoSlide that will work, just needed to dig a little more! For instance:
看起来有一个名为GotoSlide的方法可以工作,只需要多挖一点!例如:
int i = 0;
while (true)
{
i++;
objPres.SlideShowWindow.View.GotoSlide(i, MsoTriState.msoFalse);
System.Threading.Thread.Sleep(5000);
}
#3
1
I think you could do this to run them one at a time, for instance:
我认为你可以这样做,一次一个地运行它们,例如:
oSettings = objPres.SlideShowSettings
oSettings.StartingSlide = 3
oSettings.EndingSlide = 3
oSettings.Run()
Do While oApp.SlideShowWindows.Count >= 1
System.Windows.Forms.Application.DoEvents()
Loop
#4
0
You might have get a answer for you question, However for the people who will face the same kind of problem I will send a link for a opensource C# code which handles this kind of situation smoothly.
您可能已经得到了一个问题的答案,但是对于将面临同样问题的人,我将发送一个开源C#代码的链接,该代码可以顺利地处理这种情况。
https://code.msdn.microsoft.com/office/How-to-Automate-control-23cd2a8f
Download the zip file, inside there is a c# project which controls power point slides perfectly
下载zip文件,里面有一个c#项目,可以完美地控制功率点幻灯片
Best wishes folks.
祝福人们。
#1
10
The method to advance programatically is "SlideShowWindow.View.Next". You can also use "SlideShowWindow.View.Previous" to go backwards.
以编程方式推进的方法是“SlideShowWindow.View.Next”。您也可以使用“SlideShowWindow.View.Previous”向后退。
#2
3
Looks like there is a method called GotoSlide that will work, just needed to dig a little more! For instance:
看起来有一个名为GotoSlide的方法可以工作,只需要多挖一点!例如:
int i = 0;
while (true)
{
i++;
objPres.SlideShowWindow.View.GotoSlide(i, MsoTriState.msoFalse);
System.Threading.Thread.Sleep(5000);
}
#3
1
I think you could do this to run them one at a time, for instance:
我认为你可以这样做,一次一个地运行它们,例如:
oSettings = objPres.SlideShowSettings
oSettings.StartingSlide = 3
oSettings.EndingSlide = 3
oSettings.Run()
Do While oApp.SlideShowWindows.Count >= 1
System.Windows.Forms.Application.DoEvents()
Loop
#4
0
You might have get a answer for you question, However for the people who will face the same kind of problem I will send a link for a opensource C# code which handles this kind of situation smoothly.
您可能已经得到了一个问题的答案,但是对于将面临同样问题的人,我将发送一个开源C#代码的链接,该代码可以顺利地处理这种情况。
https://code.msdn.microsoft.com/office/How-to-Automate-control-23cd2a8f
Download the zip file, inside there is a c# project which controls power point slides perfectly
下载zip文件,里面有一个c#项目,可以完美地控制功率点幻灯片
Best wishes folks.
祝福人们。