简体   繁体   中英

use python to create a hyperlink leading to a specific bookmark at ms office word. ( folium map marker point)

I have created a map with markers using folium. At the popup of the marker I have managed to create a hyperlink to a "test_word" that is supposed to open and go to a specific "exixting_bookmark" of a ms word file:

folium.Marker([lat,long],popup= ("<a href=\"file:///C:/Users/.../test_doc%23**existing_bookmark**\">test_word</a>",
                              icon=folium.Icon(color='darkred')).add_to(m)

the problem is that when I click on the link, it does not work.

What am I doing wrong?

You should use double quotes inside single quotes:

folium.Marker([lat,long],popup= ('<a href=\"file:///C:/Users/.../test_doc%23**existing_bookmark**\">test_word</a>',
                              icon=folium.Icon(color='darkred')).add_to(m)

The general format for popup attribute is:

popup='<a href="myurl" target="_blank">mytext</a>',

where target="_blank" forces the browser to open the url in a new tab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM