zoukankan      html  css  js  c++  java
  • python模块——xlwt

    book = xlwt.Workbook(encoding='utf-8')
    sheet_index = book.add_sheet('首页')
    
    style = xlwt.XFStyle()  # 创建一个样式对象,初始化样式
    al = xlwt.Alignment()
    al.horz = 0x02  # 设置水平居中
    al.vert = 0x01  # 设置垂直居中
    style.alignment = al
    
    
    def add_sheet(defect_type, data_dict, i):
        sheet_i = book.add_sheet(f'{i}')
        line = 1
        for k, v in data_dict.items():
            sheet_i.write(line, 0,'数据', style)
            line += 1
    
    # 写入sheet超链接
    def add_link(d, data_dict, sheet_num, line):
        count_link = 'HYPERLINK("#%s!A1";"%s")' % (str('sheet名称'), str('名称'))
        sheet_index.write(line, index, xlwt.Formula(count_link), style)
    
  • 相关阅读:
    开发日记1
    探索需求2
    探索需求1
    周总结8
    周总结7
    周总结6
    周总结5
    周总结4
    周总结3
    周总结2
  • 原文地址:https://www.cnblogs.com/pythonwl/p/14393115.html
Copyright © 2011-2022 走看看