如何用python修改excel字体?

2025-04-08 16:19:00
推荐回答(2个)
回答1:

如果是别人制作的表格,给你审核。鼠标可能不行,用CTRL+A,进行全选后,用鼠标点击修改字体颜色,这样也很快的。

回答2:

# Initialize a style
style = xlwt.XFStyle()

# Create a font to use with the style
font = xlwt.Font()
font.name = 'Times New Roman'
font.bold = True

# Set the style's font to this new one you set up
style.font = font

# Use the style when writing
sheet.write(0, 0, 'some bold Times text', style)

利用的类库是xlwt
更多参考