`add_movie` corrupts powerpoint file when a non-openxml feature is used in animations
flavianh opened this issue · comments
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:
![image](https://private-user-images.githubusercontent.com/5397842/311646618-c1d83962-7225-4097-ad0d-c2da92670df5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU2Mjg2NzIsIm5iZiI6MTcxNTYyODM3MiwicGF0aCI6Ii81Mzk3ODQyLzMxMTY0NjYxOC1jMWQ4Mzk2Mi03MjI1LTQwOTctYWQwZC1jMmRhOTI2NzBkZjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDUxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA1MTNUMTkyNjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjMzMmJlZTQxZTFmYjg3Y2QwY2IzYzZjMTgwMGRlMWRhMzllMjg1NjM2ZDBiYWY1Zjg1YjM3OGVlODczNWRkNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.KW4LKJO5B_3uDQet_NlnlEWMriS2jSwu-Y5FMO3efBY)
(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).