Al Lelopath
Al Lelopath

Reputation: 6778

Orient text in cell to vertical with XlsxWriter?

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.

Upvotes: 7

Views: 3935

Answers (1)

SanguineL
SanguineL

Reputation: 1303

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

Upvotes: 8

Related Questions