Openpyxl中的超链接样式 [英] Hyperlink style in Openpyxl

查看:743
本文介绍了Openpyxl中的超链接样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在openpyxl中,您可以设置像这样的超链接:

In openpyxl, you can set a hyperlink like this:

cell.hyperlink = r'..\somedir\somefile.txt'

但是,这不适用于您在Excel中设置超链接时将获得的超链接样式.您可以应用带有蓝色文本和下划线的样式,但是当您打开文档时,访问的超链接不会更改颜色.

However, this does not apply the hyperlink style that you would get when setting a hyperlink in Excel. You can apply a style with blue text and underlining, but when you open the document, visited hyperlinks do not change color.

openpyxl是否可以指定一种类似于Excel中设置的超链接的超链接样式?

Is there any way with openpyxl to specify a hyperlink style that works like a hyperlink set within Excel?

推荐答案

您必须更改样式属性

cell.style = "Hyperlink"

这篇关于Openpyxl中的超链接样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆