How to set up text direction for TextTable Cell in OpenOffice?

I want to set the text direction for some cells in the TextTable to be vertical (i.e. text is landscape instead of portrait). You can do this in Writer by selecting a cell and navigating to: Table - Text Properties - Text Flow - Text Direction

However, I cannot figure out how to do this via the API. I've tried using CharRotation but it doesn't behave correctly. CharRotation just takes the text and rotates it (no formatting adjustments). The text I mean is formatted with tab stops and doesn't behave correctly when rotated this way.

+1


a source to share


1 answer


I finally figured it out after all these months!

You must set the "WritingMode" property for the cell. In C #:

XCell cell = table.getCellByName(cellName);
((XPropertySet)cell).setPropertyValue("WritingMode", new Any((short) 
WritingMode.TB_RL));

      

I haven't tried it in python yet, but I guess it would be something like this:



cell = table.getCellByName(cellName)
cell.WritingMode = 2

      

If you are using a statically typed language, make sure you drop it short. Execution typeof(WritingMode)

won't work for some odd reason.

See this issue in the OOo bug tracker.

0


a source







All Articles