static void Main(string[] args) { string fileName = @"C:\Presentation1.pptx"; string exportName = "video_of_presentation"; string exportPath = @"C:\{0}.wmv"; Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application(); ppApp.Visible = MsoTriState.msoTrue; ppApp.WindowState = PpWindowState.ppWindowMinimized; Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations; Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(fileName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse); try { oPres.CreateVideo(exportName); oPres.SaveCopyAs(String.Format(exportPath, exportName), PowerPoint.PpSaveAsFileType.ppSaveAsWMV, MsoTriState.msoCTrue); } finally { ppApp.Quit(); } }
private void button5_Click(object sender, EventArgs e) { string fileName = @"D:\Univer\Anul-III\Sem-II\SM\Lab4\SM_Lab_4\curs2.ppt"; string exportName = "video_of_presentation"; string exportPath = @"D:\Univer\Anul-III\Sem-II\SM\Lab4\SM_Lab_4\{0}.mp4"; Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application(); ppApp.Visible = MsoTriState.msoTrue; ppApp.WindowState = PpWindowState.ppWindowMinimized; Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations; Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(fileName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse); try { oPres.CreateVideo(exportName); oPres.SaveCopyAs(String.Format(exportPath, exportName), PowerPoint.PpSaveAsFileType.ppSaveAsWMV, MsoTriState.msoCTrue); } finally { ppApp.Quit(); } }