C# - 以编程方式推进PowerPoint幻灯片放映?幻灯片、方式、PowerPoint

2023-09-04 01:05:36 作者:心已倦

我希望能提前通过pressing按钮的Windows窗体一个PowerPoint presentation。下面是一些code,我发现从http://bytes.com/topic/c-sharp/answers/272940-open-powerpoint-$p$psentation-c-window-form打开一个PowerPoint presentation幻灯片:

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:

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?

(真的是我想要做的是使用WiiRemote以超前的幻灯片,一个学生项目)。

(Really what I'm trying to do is use the WiiRemote to advance the slides, for a student project).

推荐答案

推进编程的方法是SlideShowWindow.View.Next。您还可以使用SlideShowWindow.View。previous往回走。

The method to advance programatically is "SlideShowWindow.View.Next". You can also use "SlideShowWindow.View.Previous" to go backwards.