使用Microsoft Interop库将PPT转换为视频的问题

问题描述

我正在使用Microsoft Interop Library从PowerPoint演示文稿创建视频。PowerPoint演示文稿包含 内部嵌入式视频和动画。

Interope库运行良好,当在Visual Studio中运行应用程序时,我们能够成功创建视频。 当我们在IIS服务器中部署代码时,视频创建仍然可以成功进行,但是,视频内部嵌入在演示文稿中 不起作用。

是否有人对IIS和Visual Studio的这种行为有任何了解? 我们已经检查了IIS中的Mime类型以及所有扩展名.mov。 .mp4已经存在

这是代码

var videoRelativePath = "\\UserData\\User_" + templateObj.UserId + "\\VideoTemplate\\Vid_" + timeStampNew + ".mp4";
            var videoPath = _environment.ContentRootPath + videoRelativePath;
            ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "Initializing powerpoint application for video creation");
            Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
            Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
            ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "opening the presentation Instance");
            Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(
              videoFileNameForConversion,MsoTriState.msoFalse,MsoTriState.msoFalse);
            //System.Threading.Thread.Sleep(180);
            oPres.UpdateLinks();
            try
            {
                //CreateVideo(string FileName,bool UseTimingsAndNarrations,int DefaultSlideDuration,int VertResolution,int FramesPerSecond,int Quality)
                ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "Calling CreateVideo ");
                oPres.CreateVideo(videoPath);
                while (oPres.CreateVideoStatus == Microsoft.Office.Interop.PowerPoint.PpMediaTaskStatus.ppMediaTaskStatusInProgress || 
                oPres.CreateVideoStatus == Microsoft.Office.Interop.PowerPoint.PpMediaTaskStatus.ppMediaTaskStatusQueued)
                {
                    System.Threading.Thread.Sleep(10000);
                }
             }

            catch (Exception er)
            {
                ErrorLoging.LogErrorInLogFile(er);

            }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...