Text direction in apache poi

2019-09-16 19:51发布

问题:

How to make the text direction in Apache poi as Vertical. I tried Vertical alignment. I am not able to get the desired results. I don't want to rotate the text. Something like :

T
E
X
T

回答1:

You have to create a cellStyle, where You have a method setRotation(short rotation). Subsequently apply the cellstyle to Your cell.

docs, for setRotation https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCellStyle.html#setRotation(short)