zl程序教程

您现在的位置是:首页 >  后端

当前栏目

python 设置excel 页面页边距,行高,列宽代码

PythonExcel代码 设置 页面
2023-09-11 14:20:48 时间

python 设置excel 页面页边距,行高,列宽

wb=xlrd.open_workbook(mbfn, formatting_info=True)       #打开另一张excel的表格 模板
new_wb =copy(wb)         #将xlrd对象拷贝转化为xlwt对象,要用到xlutils模块
new_sheet = new_wb.get_sheet(0)   #读取Excel的第一张工作表
new_sheet.show_headers = False
new_sheet.header_str = b''
new_sheet.footer_str = b''
new_sheet.col(1).width = 2660
new_sheet.col(2).width = 6500
new_sheet.col(0).width = 250
new_sheet.set_top_margin(0.196)
new_sheet.set_bottom_margin(0)
new_sheet.set_left_margin(0)
new_sheet.set_right_margin(0.55)