如何使用 python 格式化 Excel 中的单元格?
特别是我需要更改几个后续行的字体 规则而不是粗体。
最佳答案
使用 xlwt :
from xlwt import *
font0 = Font()
font0.bold = False
style0 = XFStyle()
style0.font = font0
wb = Workbook()
ws0 = wb.add_sheet('0')
ws0.write(0, 0, 'myNormalText', style0)
font1 = Font()
font1.bold = True
style1 = XFStyle()
style1.font = font1
ws0.write(0, 1, 'myBoldText', style1)
wb.save('format.xls')
https://stackoverflow.com/questions/1029500/