Change width and height of Excel cell using xlwt

1

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?

    
asked by anonymous 21.09.2016 / 22:19

1 answer

0

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:

    
22.09.2016 / 22:16