我找不到如何在文本框中设置文本垂直方向的示例
我找到了如何旋转单元格中的文本,但我需要旋转文本框中的文本
文本框代码
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})
关于python - 使用 XlsxWriter 将文本框或文本框中的文本定向为垂直?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56818434/