繁体   English   中英

使用C#将PPS / PPT文件另存为SWF

[英]Save PPS/PPT files as SWF using C#

我想构建一个将pps \\ ppt文件另存为SWF的C#应用​​程序。 要将pps \\ ppt保存为图像,请使用以下代码:

Application apps = new Application();
Presentations pps = apps.Presentations;

    foreach (string file in Directory.GetFiles("[here is a path]", "*.ppt"))
    {
          try
          {
          Presentation p = pps.Open(file, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
          p.SaveAs("[here is a path]" + p.Name, PpSaveAsFileType.ppSaveAsJPG); //It saves the slides as images in a folder.
          Console.WriteLine(id.ToString() + ". " + p.Name);
          p.Close();
          id++;
          }
          catch{ }
    }

那么,如何将文件夹中的pps \\ ppt文件另存为SWF? 没有这个: PpSaveAsFileType.ppSaveAsSWF

不,您不能使用PowerPoint API。

要将PowerPoint文件转换为Flash,您需要寻找出售特定API的软件供应商。

无论如何,并非所有PowerPoint对象/功能都受支持,因此您可能会丢失某些内容。

当然,如果您自己开发应用程序,但是您需要PowerPoint API和Flash的强大知识,并且需要从Flash访问pptx(openxml)文件,这是可以做到的。

您需要使用某些具有C#API的第三方软件来转换PPT文件。 我为此使用print2flash。 如果我省略了真正的C#应用​​程序中的某些选项,则我使用的核心转换代码非常简单

Print2Flash4.Server2 serv = new Print2Flash4.Server2();
Print2Flash4.Profile2 prof = new Print2Flash4.Profile2();
prof.DocumentType = Print2Flash4.DOCUMENT_TYPE.FLASH;
serv.ConvertFile(inputfile, swf_file, prof, null, null);

要使用此代码,您还需要获取Interop.Print2Flash4.dll。 您可能会从sdk中获得dll和进一步的说明,可从http://print2flash.com/download.php下载。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM