【Python學習】python操作excel超鏈接


= 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\", \"詳情\")\r", hyper_style)
# write_table_of_sheet0.write(13, 2, u"=HYPERLINK(\"#鏈接!a1\", \"鏈接\")\r", hyper_style)
write_table_of_sheet0.write(11, 2, xlwt.Formula(u"HYPERLINK(\"#詳情!a1\", \"詳情\")\r"), hyper_style)
write_table_of_sheet0.write(13, 2, xlwt.Formula(u"HYPERLINK(\"#鏈接!a1\", \"鏈接\")\r"), hyper_style)

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM