使用 XlsxWriter 将文本框或文本框中的文本定向为垂直?

Orient textbox or text in textbox to vertical with XlsxWriter?

我找不到如何在文本框中设置文本垂直方向的示例

我找到了如何旋转单元格中的文本,但我需要旋转文本框中的文本

文本框代码

text = 'Some text in a textbox'
options = {
'font': {'color': 'white'},
'align': {'vertical': 'middle',
           'horizontal': 'center',
          },
'gradient': {'colors': ['red', 'blue']},
}
worksheet.insert_textbox(row, col, text, options)

单元格中带有旋转文本的代码

cell_format = workbook.add_format()
cell_format.set_rotation(90)
worksheet.write(1, 1, 'This text is rotated')
worksheet.set_column(col, col, None, cell_format)

这不是当前可用的功能,但如果您打开 Feature Request on GitHub 我可以添加它。

更新:XlsxWriter >= 1.2.4 现在可用。

来自更新后的docs

The text_rotation option can be used to set the text rotation for the entire textbox:

    worksheet.insert_textbox('B2', 'Text rotated up',
                             {'text_rotation': 90})