I have a Windows desktop C# app which is to export user's pptx to mp4 programmatically.
I have code here:
try
{
Application application = new Microsoft.Office.Interop.PowerPoint.Application();
Presentation ppt = application.Presentations.Open("myppt.pptx", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);
ppt.CreateVideo("myppt.mp4");
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
Everything works fine and video is created successfully with Powerpoint 2016 and older version Office 365 powerpoint. However after I upgraded Office 365 to latest version 2203 (15028.20160), CreateVideo() always failed and throws exception: "The remote procedure call failed"
System.Runtime.InteropServices.COMException (0x800706BE): 遠端程序呼叫失敗。 (發生例外狀況於 HRESULT: 0x800706BE)
於 Microsoft.Office.Interop.PowerPoint._Presentation.CreateVideo(String FileName, Boolean UseTimingsAndNarrations, Int32 DefaultSlideDuration, Int32 VertResolution, Int32 FramesPerSecond, Int32 Quality)
I have also tried Presentation.SaveCopyAs(...) and Presentation.Slides[x].Export(...) and these functions work fine.
Any help would be appreciated.
Update:
CreateVideo() works if set "WithWindow" parameter to true in Presentation ppt = application.Presentations.Open("myppt.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoTrue)
But I don't know the reason...