问题
I'm working on an application which reads a Powerpoint presentation from disk and saves it in video format using the following pseudocode:
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 ...
this process takes very long to complete, so I would like to add a progress indicator. I know that this progress information is available - Powerpoint itself shows an exact progress bar when exporting to video from within powerpoint. Is there a way to read this progress, get this as an event, or poke around the powerpoint api to get some kind of progress percentage? All help is greatly appreciated.
回答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
来源:https://stackoverflow.com/questions/19095550/powerpoint-2013-progress-for-export-to-video