python 导出excel 设置单元格宽度
2021-04-02 14:25 idea555 阅读(971) 评论(0) 收藏 举报ds_root_path = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) # 获取项目根目录
wb = xlwt.Workbook()
# ws = wb.add_sheet('报修数据报表')
ws = wb.add_sheet("Sheet1")
first_col = ws.col(0) # xlwt中是行和列都是从0开始计算的
second_col = ws.col(1)
third_col = ws.col(2)
four_col = ws.col(3)
five_col = ws.col(4)
six_col = ws.col(4)
first_col.width = 158 * 20
second_col.width = 230 * 20
third_col.width = 230 * 20
four_col.width = 230 * 20
five_col.width = 100 * 20
six_col.width = 100 * 20
浙公网安备 33010602011771号