python超链接格式_Openpyxl中的超链接样式「建议收藏」

python超链接格式_Openpyxl中的超链接样式「建议收藏」4个答案:答案0:(得分:1)importopenpyxlfromopenpyxl.stylesimportFont,Color,colors#…#alternative1:sethyperlinkpropertytocelldeflink_1(cell,link,display=None):cell.hyperlink=linkcell.font=…

大家好,又见面了,我是你们的朋友全栈君。

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.net/161744.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • h3c路由器配置命令_h3c路由器命令大全

    h3c路由器配置命令_h3c路由器命令大全en进入特权模式conf进入全局配置模式ins0进入serial0端口配置ipaddxxx.xxx.xxx.xxxxxx.xxx.xxx.xxx添加ip地址和掩码,电信分配encahdlc/ppp捆绑链路协议hdlc或者pppipunne0exit回到全局配置模式ine0进入以太接口配置ipaddxxx.xxx.xxx.xxxxxx.xxx.xxx…

    2022年10月18日
    0
  • JavaScript(1)高阶函数filter、map、reduce

    JavaScript(1)高阶函数filter、map、reduce前言需求:有这样一个数组[10,20,110,200,60,30,40]1.筛选出数组中小于100的元素2.将筛选出的每个元素的值x23.完成第2步之后,将数组中的所有元素加起来

    2022年7月31日
    3
  • 【我的Android进阶之旅】解决重写onTouch事件提示的警告:onTouch should call View#performClick when a click is detected

    【我的Android进阶之旅】解决重写onTouch事件提示的警告:onTouch should call View#performClick when a click is detected一、问题描述当你对一个控件(例如ImageView)使用setOnTouchListener()或者是对你的自定义控件重写onTouchEvent方法时会出现这个警告,警告内容全文如下:MyImageOnTouchListener#onTouchshouldcallView#performClickwhenaclickisdetectedless…(Ctrl+F…

    2022年6月17日
    29
  • Java除法运算(保留小数)

    Java除法运算(保留小数)编程的人都知道,java中的“/”、“%”运算,其中前者为取整,后者取余数。那么有没有快捷的运算方法取正常的运算结果呢?查了资料,发现很简单。代码如下: /** *TODO除法运算,保留小数 *@author袁忠明 *@date2018-4-17下午2:24:48 *@parama被除数 *@paramb除数 *@return商 */ pu…

    2022年5月3日
    47
  • Centos 7镜像官网下载

    Centos 7镜像官网下载换了mac,安装虚拟机到时候,下载Centos7镜像,发现到官网下载试了好几个国内镜像,发现根本下不下来,下载进度一直是0.0,可能是网络问题吧,可是我试了家里到Wi-Fi,公司到Wi-Fi,也连了自己手机分出来的热点,发现还是一样,我不禁纳闷了,以前在windows上下载过到,虽然很大,但是花费一些时间还是能下载下来到。于是我试了一下下面这个清华大学的镜像,发现可以下载,并且下载速度非常快,…

    2022年10月20日
    0
  • Oracle运算符

    Oracle运算符

    2021年8月15日
    46

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号