Python xlwt - accessing existing cell content, auto-adjust column width

后端 未结 6 1265
一向
一向 2020-11-29 03:17

I am trying to create an Excel workbook where I can auto-set, or auto-adjust the widths of the columns before saving the workbook.

I have been reading the Python-Ex

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 03:29

    FitSheetWrapper should have a little modify with xlwt3 in 3.3.4

    line 19:

    change:

    width = arial10.fitwidth(label)
    

    to:

    width = int(arial10.fitwidth(label))  
    

    reason: \Python\3.3.3\Lib\site-packages\xlwt3\biffrecords.py

    1624 def __init__(self, first_col, last_col, width, xf_index, options):
    1625        self._rec_data = pack('<6H', first_col, last_col, width, xf_index, options, 0)
    

    width must be integer.

提交回复
热议问题