I want to set the text direction for some cells in a TextTable so that they are vertical (i.e., the text is landscape instead of portrait).
You can do this in Writer by selecting the cell(s), and going to:
Table – Text Properties – Text Flow – Text Direction
However, I cannot figure out how to do this through the API. I tried using CharRotation, but it does not behave the right way. CharRotation simply takes the text, and rotates it (without adjusting any formatting). The text I am dealing with is formatted by tab stops, and does not behave correctly when rotated this way.
I finally figured this out after all these months!
You have to set the “WritingMode” property for the cell. In C#:
I haven’t tried it in python yet, but I suppose it would be something like this:
If you’re using a statically typed language, make sure you cast it to a short. Doing
typeof(WritingMode)won’t work, for some odd reason.See this issue in the OOo bug tracker.