We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The Animation Duration of the Slide Shape Cannot Be Obtained

The animation duration of the slide shape cannot be obtained by using the related api, prompt naN
slide.java 21.2
<a class=“attachment” hreppt21.zip (432.4 KB)
e4a7289b9fd01169b482d599977a7e4.png (18.6 KB)

PPT无法读取动画的播放时间 Running with the code of this post is the same result

Thank you for contacting support.

Animation effect total duration is defined as the maximum value between the durations of the effect and all its behaviors. Please use the following code example:

Presentation presentation = new Presentation("ppt21.pptx");
ISlide slide = presentation.getSlides().get_Item(0);

for (IShape shape : slide.getShapes())
    IEffect[] effects = slide.getTimeline().getMainSequence().getEffectsByShape(shape);
    for (IEffect effect : effects)
        float effectDuration = effect.getTiming().getDuration();

        for (IBehavior behavior : effect.getBehaviors())
            if (Float.isNaN(effectDuration) || behavior.getTiming().getDuration() > effectDuration)
                effectDuration = behavior.getTiming().getDuration();

        System.out.println("Effect duration: " + effectDuration);


Effect duration: 0.5
Effect duration: 1.0
Effect duration: 0.5
Effect duration: 0.5
Effect duration: 0.5

API Reference: IBehavior Interface