xlsxwriter模块add_format参数详解

workbook.add_format([格式字典])

# 数字
num_format = 'General'    # 数字格式
 
# 字体
font_name = 'Arial'       # 字体
font_size = 11            # 字号
font_color = 0x0          # 颜色
bold = True               # 加粗
italic = True             # 斜体
underline = 0             # 下划线,0:无;1:单下划线;2:双下划线;……
font_strikeout = True     # 删除线
font_script = 0           # 上下标,0:无;1:上标;2:下标
font_outline = True       # 轮廓
font_shadow = True        # 阴影
 
# 保护
hidden = False            # 隐藏
locked = True             # 锁定
 
# 对齐
align = 'left'            # 水平对齐 'left'|'centre'|'right'|'fill'|'justify'|'centre_across'|'distributed'|'justify_distributed'
valign = 'vcentre'        # 垂直对齐 'top'|'vcentre'|'bottom'|'vjustify'|'vdistributed'
text_wrap = True          # 自动换行
rotation = 0              # 旋转
indent = 1                  # 缩进
shrink = True              # 缩小字体填充
 
# 填充
pattern = 1                  # 图案样式
fg_color = 0              # 前景色
bg_color = 0              # 背景色
 
# 边框
border = 0                  # 边框,0:无边框;1:外边框;……
border_color = 0x0          # 边框颜色
diag_border = 0
diag_color = 0x0
diag_type = 0
bottom = 0                  # 底边框
bottom_color = 0x0          # 底边框颜色
left = 0                  # 左边框
left_color = 0x0          # 左边框颜色
right = 0                  # 右边框
right_color = 0x0          # 右边框颜色
top = 0                      # 上边框
top_color = 0x0              # 上边框颜色具体 

其余配置参数可以参考官网:
The Format Class — XlsxWriter Documentation

猜你喜欢

转载自blog.csdn.net/m0_56730596/article/details/128249819