Search code examples
javaexceltextapache-poidirection

How to change text direction in excel cell using java poi?


I want to change Text_Direction (not Alignment) of a single cell (not worksheet) on an excel file using java Apache_poi library. how can I do it? thanks.


Solution

  • after looking a lot I found another way that will fix the problem. As explained here , it's just needed to change the direction of the text that will be placed in the cell. the solution will be like below for right to left:

    String rtl = "\u200F" + otherTexts;
    

    and like this for LTR:

    String left2right_text = "\u200E" + otherTexts;