![](/img/trans.png)
[英]How to save *.ppt, *.pptx files as *.wmv using Interop with C#?
[英]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.