scanny / python-pptx

Create Open XML PowerPoint documents in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hyper Link to external sources

adumitrescu20 opened this issue · comments

Hello, I am currently trying to manually change a powerpoint and send the file over an api request for a project, however when I try to hyperlink the sources in a shape like this:

run = paragraph.add_run()
hlink = run.hyperlink
hlink.type = "run"
hlink.address = i["source"]
add_text(run, i["source"]+ "\n", 8, "Calibri", True)

with the add text function being
def add_text(run, text, font_size, font, bold):
run.text = text
run.font.size = Pt(font_size)
run.font.name = font
run.font.bold = bold

the problem is that this clearly hyperlinks the text as the font color changes to blue and is underlined, however I can not click and be redirected to the source at all, has this been encountered before by anyone/ am I setting the hyperlink wrong?

The shapes I am trying to hyperlink text for are not in the presentation itself they are off to the side. My desire is to be able to click on the hyperlink when editing the ppt is that possible with ppt?

I believe hyperlinks are only active in slide-show mode.

This makes sense otherwise you wouldn't be able to select them when in edit mode :)