python超链接格式_Openpyxl中的超链接样式「建议收藏」
大家好,又见面了,我是你们的朋友全栈君。
4 个答案:
答案 0 :(得分:1)
import openpyxl
from openpyxl.styles import Font, Color, colors
#…
# alternative 1: set hyperlink property to cell
def link_1(cell, link, display=None):
cell.hyperlink = link
cell.font = Font(u=’single’, color=colors.BLUE)
if display is not None:
cell.value = display
# alternative 2: use Excel formula HYPERLINK
def link_2(cell, link, display=’link’):
cell.value = ‘=HYPERLINK(“%s”, “%s”)’ % (link, display)
cell.font = Font(u=’single’, color=colors.BLUE)
# examples
link_1(ws[‘B2’], ‘#sheet3!A1’, ‘link_text’) # internal link
link_2(ws[‘B3’], ‘#sheet3!A1’, ‘link_text’) # internal link
link_1(ws[‘B4’], ‘https://www.google.com/’, ‘Google’) # web link
答案 1 :(得分:1)
您必须更改样式属性
cell.style = “Hyperlink”
答案 2 :(得分:0)
尝试添加像这样的超链接样式
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
Byte bytes[8];
bytes[0] = 0xFE;
bytes[1] = 0x03;
bytes[2] = 0x01;
bytes[3] = 0x00;
bytes[4] = 0xB4;
bytes[5] = 0x18;
bytes[6] = 0x01;
bytes[7] = bytes[1] ^ bytes[2] ^ bytes[3] ^ bytes[4] ^ bytes[5] ^ bytes[6];
NSData *data = [NSData dataWithBytes:bytes length:sizeof(bytes)];
NSLog(@”%@”, data);
NSString *str = [[NSString alloc] initWithBytes:&bytes length:8 encoding:NSUTF8StringEncoding];
NSLog(@”%@”, str);
}
return 0;
}
答案 3 :(得分:0)
我使用Font并且它有效。
from openpyxl.styles import Font
hyperlink = Font(underline=’single’, color=’0563C1′)
# …
cell.font = hyperlink
应该有一个名为Hyperlink的{{3}},但我还没有设法让它发挥作用……
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/161744.html原文链接:https://javaforall.cn
相关文章
- Python办公自动化 | 批量word生成工具2.0
- 【Python矩阵转置】| 试使用多方法实现[通俗易懂]
- python中merge函数「建议收藏」
- Python 一网打尽<排序算法>之堆排序算法中的树
- Python 细聊从暴力(BF)字符串匹配算法到 KMP 算法之间的精妙变化
- Python 偏函数
- java异或运算符_python 异或
- php sigpipe,Python的SIGPIPE信号「建议收藏」
- Python ( )、[ ]、{}的区别「建议收藏」
- 用Python的好处
- python构建IP代理池(Proxy Pool)[通俗易懂]
- 用Python爬了微信好友,原来他们是这样的人...
- python字符串编码及乱码解决方案
- python中astype用法_浅谈python 中的 type(), dtype(), astype()的区别[通俗易懂]
- Python自动给抖音小姐姐视频点赞
- python解决 ModuleNotFoundError: No module named _bz2
- Python 使用三方模块
- python encode和decode函数说明[通俗易懂]
- python转置矩阵函数_对python 矩阵转置transpose的实例讲解
- Python基础10-函数的递归