= HYPERLINK(“{}”,“{}”)’.format(链接,“链接名称”)
import xlwt wb = xlwt.Workbook() ws = wb.add_sheet('test')
# 链接
style = xlwt.easyxf('font: name Times New Roman, color-index red, bold on',
num_format_str='#,##0.00')
al = xlwt.Alignment()
al.horz = 0x02 # 设置水平居中
al.vert = 0x01 # 设置垂直居中
style.alignment = al
# 链接
# write_table_of_sheet0.write(11, 2, u"=HYPERLINK("#详情!a1", "详情")
", hyper_style)
# write_table_of_sheet0.write(13, 2, u"=HYPERLINK("#链接!a1", "链接")
", hyper_style)
write_table_of_sheet0.write(11, 2, xlwt.Formula(u"HYPERLINK("#详情!a1", "详情")
"), hyper_style)
write_table_of_sheet0.write(13, 2, xlwt.Formula(u"HYPERLINK("#链接!a1", "链接")
"), hyper_style)