Change lag and height of Excel cell using xlwt

Asked

Viewed 556 times

2

I need to change the height and width of the Excel cell I’m using the library xlwt. I can’t find any references, someone can help me?

1 answer

0


You can set the width and height of a particular row or column using the properties width and height leaf.

Take 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')

Upshot:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.