python wlwt写入excel操作

 

安装命令:pip3 install xlwt

方法数据介绍

Workbook(class) 由xlwt.Workbook()返回

encoding:                 编码方案
add_sheet(sheet_name):    添加sheet
get_sheet(Sheet_name):    选择sheet
save(file_name):          保存

Worksheet(class) 由Workbook object相关方法返回 

write(rows,colx,cell_value,style):         编辑单元格
row(rowx).write(colx,cell_value,style):    编辑行
flush_row_data():                          减少内存压力,flush之前行不可再修改
col(colx),write(rows,cell_value,style):    编辑列

easyxf(function) 创建XFStyle instance,格式控制

expression syntax: (<element>:(<attribute> <value>,)+;)+
<element> - <attribute> - <value>:
(加粗为默认格式,以下所列并非全部)
font      - bold          - True or False
          - colour        - {colour}
          - italic        - True or False
          - name          - name of the font, Arial
          - underline     - True or False

alignment - direction     - general, lr, rl
          - horizontal    - general, left, center, right, filled 
          - vertical      - bottom, top, center, justified, distributed
          - shrink_to_fit - True or False

bolders   - left          - an integer width between 0 and 13
          - right         - an integer width between 0 and 13
          - top           - an integer width between 0 and 13
          - bottom        - an integer width between 0 and 13
          - diag          - an integer width between 0 and 13
          - left_colour   - {colour}*, automatic colour
          - right_colour  - {colour}*, automatic colour
          - ...

pattern   - back_color    - {colour}*, automatic colour
          - fore_colour   - {colour}*, automatic colour
          - pattern       - none, solid, fine_dots, sparse_dots

 

{colous}*: black, (dark_)(light_)blue, gold, (dark_)(light_)green, ivory, lavender,

           (light_)orange, pink, (dark_)red, rose, violet, white, (dark_)(light_)yellow, ...
方法以及返回值格式参数介绍

相关文章:

  • 2021-04-16
  • 2022-12-23
  • 2021-10-22
  • 2021-08-26
  • 2021-07-29
  • 2021-12-23
  • 2021-12-29
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
相关资源
相似解决方案