python 導出excel 設置單元格寬度


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM