0

I wrote a python code to change a text in a powerpoint presentation with python pptx. I want to change my code to edit the hyperlink of an embedded video in Powerpoint but I can't figure out how to do it.

Can anyone help? Below is my code

Thanks!

search_str = ".html"
repl_str = ".aspx"
for slide in prs.slides:
    for shape in slide.shapes:
        if shape.has_text_frame and search_str in shape.text:
           newtext = shape.text.replace(search_str,repl_str)
           shape.text = newtext
           prs.save(eachfile)

1 Answers1

0

I think your code should be as below?

shape.has_text_frame.text
shape.TextFrame.text

Refer the below link for the documentation: https://python-pptx.readthedocs.io/en/latest/api/text.html?highlight=textframe%20text#pptx.text.text.TextFrame.text

Ashoka
  • 101
  • 5