scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.46k stars 529 forks source link

Hyperlink Screentip being set, but not showing in Powerpoint #1022

Open paulbrazell opened 3 weeks ago

paulbrazell commented 3 weeks ago

I have a function that is setting the Hyperlink's screen_tip property:

cell_link = cell.text_frame.paragraphs[0].add_run()
cell_link.text = display_text
hlink = cell_link.hyperlink
hlink.address = url
if screen_tip:
    print(f"Has a screen_tip: {screen_tip}")
    hlink.screen_tip = screen_tip
    print(hlink.screen_tip)

This outputs the correct information when I print the input variable and the hlink.screen_tip, but when I view this in Powerpoint the ScreenTip is not present.

Tested on versions 0.6.22 and 1.0.2. Validating with Powerpoint Version 16.86 on Mac.

Maybe i'm doing something wrong, but seems to be correct per the documentation.

paulbrazell commented 3 weeks ago

After reading "The link XML is not written until .address is specified.", edited the code to the following and i still see the same behavior

cell_link = cell.text_frame.paragraphs[0].add_run()
cell_link.text = display_text
hlink = cell_link.hyperlink
if screen_tip:
    print(f"Has a screen_tip: {screen_tip}")
    hlink.screen_tip = screen_tip
    print(hlink.screen_tip)
hlink.address = url