Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orient text in cell to vertical with XlsxWriter?

Tags:

I see a couple examples of how to set the orientation of a text box, but not cell in a text box. I see how to format other things, like bold:

bold_format = workbook.add_format({'bold': True})
worksheet.write('A1', "something", bold_format)

but not vertically oriented text.

like image 564
Al Lelopath Avatar asked Oct 29 '18 16:10

Al Lelopath


1 Answers

You can use set_rotation.

import xlsxwriter

workbook = xlsxwriter.Workbook("test.xlsx")
worksheet = workbook.add_worksheet()
worksheet.set_landscape()

bold_format = workbook.add_format({'bold': True})
bold_format.set_rotation(90)

worksheet.write('A1', "something", bold_format)

workbook.close()

For the entire documentation on set_rotation() visit: https://xlsxwriter.readthedocs.io/format.html#format-set-rotation

like image 92
SanguineL Avatar answered Oct 11 '22 21:10

SanguineL