python-pptx
python-pptx copied to clipboard
`add_movie` corrupts powerpoint file when a non-openxml feature is used in animations
When a non-openxml feature is used in animations, Powerpoint wraps the <p:timing>
element in a <mc:AlternateContent>
.
For example, setting Bounce end
to true:
(see enclosed file: file_with_bounce.pptx )
However, python-pptx
assumes that <p:timing>
is at the root of <p:sld>
and creates a new <p:timing>
.
This results in a powerpoint file that has the form:
<p:sld>
...
<mc:AlternateContent>
<mc:Choice>
<p:timing>
... (timing without video)
</p:timing>
</mc:Choice>
...
</mc:AlternateContent>
<p:timing>
... (video timing)
</p:timing>
</p:sld>
The file is then detected as corrupt and deleted.
I can make the fix, but I would need to know where I can find a standard way to account for AlternateContent
in the lib?
Thanks
I added mine to the slide.element
in md2pptx. If you search for the definition and use of the function addSlideTransition
in my code you'll see what I mean.
However, I also would like to understand what would be closer to the heart of python-pptx in this matter.
(Very secondarily, extensions to that code's capability are something I'd contemplate. But I don't actually use transitions in my day job, though I built md2pptx (and mdpre) for my daily needs.)
@MartinPacker the animation is added externally through Powerpoint in my case, and this is intentional in my workflow. I think this is different from slide transitions too, because slide transitions are transitions between slides, and animations are within the slide itself. I don't know the office open xml spec very well, but animations are specified in a single <p:timing>
element (or multiple, when using features out of the standard).