text orientation on excel(individual cell) in python

python, xlwt

Solution

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.

Problem

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

Original source