Deepak Dubey
Deepak Dubey

Reputation: 309

text orientation on excel(individual cell) in python

I am trying to write some data on excel file, and want to keep first row text orientation as 90 degree.

style = xlwt.easyxf('font: bold 0, color black, underline 0,height 250; alignment: horizontal left')

Upvotes: 4

Views: 4749

Answers (1)

alecxe
alecxe

Reputation: 473853

Here's an example how you can do this:

import xlwt

style = xlwt.easyxf('align: rotation 90')

workbook = xlwt.Workbook()
worksheet = workbook.add_sheet('Test')
worksheet.write(0, 0, label='Formatted value', style=style)
workbook.save('test.xls')

You can use rota or rotation keyword.

FYI, here's the function being called under the hood.

Hope that helps.

Upvotes: 5

Related Questions