标签:form excel test enter style 属性 span bsp exce
1 # -*- coding: utf-8 -*- 2 import xlsxwriter 3 4 workbook = xlsxwriter.Workbook(‘test.xlsx‘) 5 worksheet = workbook.add_worksheet("test") 6 worksheet.set_column("A:A", 40) #设置列宽度 7 worksheet.set_row(0, 30) #设置行高度 8 9 format = workbook.add_format({‘color‘:‘red‘}) #获取单元格属性 10 #{‘bold‘: True, ‘font_size‘: 14, ‘align‘: ‘center‘,‘valign‘: ‘vcenter‘,‘border‘:1, ‘color‘:‘red‘, ‘bg_color‘:‘blue‘} 11 #dir(format) #可以显示属性的种类 12 #format.set_bold() #设置粗体 13 worksheet.write("A1", ‘runnable‘, format) #以指定格式写入内容 14 workbook.close()
python xlsxwriter写excel并操作各种格式属性
标签:form excel test enter style 属性 span bsp exce
原文地址:https://www.cnblogs.com/hushaojun/p/9973646.html