none
Audio is not getting converted while converting PPT to video RRS feed

  • Question

  • I am using Microsoft.Office.Interop.PowerPoint c# library to convert PPT to video. It converts the slides to video but does not include audio used in the PPT to the converted video file.

    string strPath = @"D:\";
    bool validName = false;
                    string nFile = "testppt";
                    Application objApp;
                    Presentation objPres;
                    objApp = new Application();
                    objApp.Visible = MsoTriState.msoTrue;
                    objApp.WindowState = PpWindowState.ppWindowMinimized;
                    objPres = objApp.Presentations.Open(@"D:\testppt.ppt", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue);
    
                    try
                    {
                      
                        if (!nFile.Contains(".mp4"))
                        {
                            nFile += ".mp4";
                        }
                        objPres.SaveAs(System.IO.Path.Combine(strPath, nFile), PpSaveAsFileType.ppSaveAsMP4, MsoTriState.msoTrue);
                        // Wait for creation of video file
                        while (objApp.ActivePresentation.CreateVideoStatus == PpMediaTaskStatus.ppMediaTaskStatusInProgress || objApp.ActivePresentation.CreateVideoStatus == PpMediaTaskStatus.ppMediaTaskStatusQueued)
                        {
    
                            System.Threading.Thread.Sleep(500);
                        }
    
    
                        objPres.Close();
                        objApp.Quit();
                        // Release COM Objects
                        System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objPres);
                        objPres = null;
                        System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objApp);
                        objApp = null;
                        GC.Collect();
                        GC.WaitForPendingFinalizers();
    
                    }
                    catch (Exception ex)
                    {
    
                    }
    Monday, October 21, 2019 4:35 AM