2

我正在开发一个应用程序,该应用程序从磁盘读取 Powerpoint 演示文稿并使用以下伪代码将其保存为视频格式:

var app = new ppt.Application();
ppt.Presentation file = app.Presentations.Open(
                this.SourceFilename,
                MsoTriState.msoFalse,
                MsoTriState.msoFalse,
                MsoTriState.msoFalse);
file.CreateVideo(this.DestinationFilename);
while (true)
{
    switch (file.CreateVideoStatus)
    {
        case PpMediaTaskStatus.ppMediaTaskStatusDone: ...
        case PpMediaTaskStatus.ppMediaTaskStatusFailed: ...
        case PpMediaTaskStatus.ppMediaTaskStatusInProgress ...

这个过程需要长时间才能完成,所以我想添加一个进度指示器。我知道这个进度信息是可用的 - 当从 powerpoint 中导出到视频时,Powerpoint 本身会显示一个确切的进度条。有没有办法读取这个进度,把它作为一个事件,或者在 powerpoint api 周围戳一下以获得某种进度百分比?非常感谢所有帮助。

4

1 回答 1

1

I think that polling ResampleMediaTasks.PercentComplete might give you what you're after. Haven't tried it myself but the (as usual, pathetically scant and incomplete) help in PPT VBA suggests that it's what you want

于 2013-09-30T19:27:39.400 回答