I need to change height and cell width of Excel I'm using the xlwt
library. I did not find any references, can anyone help me?
I need to change height and cell width of Excel I'm using the xlwt
library. I did not find any references, can anyone help me?
You can set the width and height of a particular row or column using the width
and height
properties of the sheet.
See an example:
# -*- coding: utf-8 -*-
import xlwt
book = xlwt.Workbook(encoding = 'utf-8')
""" Define o nome da folha """
sheet = book.add_sheet('SOpt')
""" Define a altura da segunda linha """
sheet.row(1).height_mismatch = True
sheet.row(1).height = 256 * 2
""" Define a largura da segunda coluna - 30 caracteres """
sheet.col(1).width = 256 * 30
""" Escreve na segunda linha da segunda coluna - B2 """
sheet.write(1, 1, 'Stack overflow em Português!')
book.save('sopt.xls')
Result: