试图在vs2010 c#表单中查看MS PowerPoint 2010文件

本文关键字:MS PowerPoint 2010文件 表单 vs2010 | 更新日期: 2023-09-27 18:16:08

我花了三个星期的时间在谷歌上搜索,我找到了一些片段,但没有一个是有用的。我在试着写一个c#程序,可以看ppt。我不知道怎么做。我看了这么多的片段和Ppt互操作中的MSDN页面,我完全不知所措。有人这样做了吗,或者知道如何快速演示代码,向我展示如何做到这一点?尽可能少的代码使其工作将是最好的。我要做的是这样的:一张ppt幻灯片将在一个图片框中显示,每40秒它将切换到下一张幻灯片。我不允许将ppt导出为图片,并加载图片(我也不知道该怎么做)。如果有人想知道,是的,这是一门编程课,但它不是一个评分作业。我在这上面花了三周时间,快把我逼疯了。任何帮助都将不胜感激。谢谢你!如果有帮助,下面是我到目前为止自己想出的所有工作代码,这和我想要完成的完全不同。

        PowerPoint.Application oPPT;
    PowerPoint.Presentations objPresSet;
    const string strPres = @"E:'C#'Ch 16'PP Stuff'TestTextBox'TextBoxTestWithArrays'TextBoxTestWithArrays'Ad Analysis.pptx";
    const string myPath = @"E:'C#'Ch 16'PP Stuff'TestTextBox'TextBoxTestWithArrays'TextBoxTestWithArrays'";
{
        oPPT = new PowerPoint.Application();
        oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
        objPresSet = oPPT.Presentations;
        objPresSet.Open(strPres, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
    /*
     * This crashes, and I'm clueless as to why it wouldn't work. I wanted it here
     * to check the # of msg boxes that opened against the # of slides in the ppt.
     */
        foreach (PowerPoint.Slides mySlides in objPresSet)
            MessageBox.Show("{0}", mySlides.ToString());
}

试图在vs2010 c#表单中查看MS PowerPoint 2010文件

请看http://skp.mvps.org/vb/pptvbwnd.htm它解释了如何在VB5/6中显示和控制窗体上的表示,但可能会给你一些想法。