Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_movie corrupts powerpoint file when a non-openxml feature is used in animations #954

Open
flavianh opened this issue Mar 11, 2024 · 2 comments

Comments

@flavianh
Copy link

flavianh commented Mar 11, 2024

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

(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

@MartinPacker
Copy link

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.)

@flavianh
Copy link
Author

@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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants