Page 1 of 1

want to rotate text

PostPosted: Fri May 18, 2018 6:46 pm
by gosavi_pankaj
Hi ,
I want to rotate text in textbox in word application. Is there any way in docx4j for same?


Regards,
Pankaj G

Re: want to rotate text

PostPosted: Mon May 21, 2018 9:28 pm
by jason
How about using what Word calls a "vertical text box":

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
            <w:r>
                <w:rPr>
                    <w:noProof/>
                    <w:lang w:eastAsia="ja-JP"/>
                </w:rPr>
                <w:pict>
                    <v:shapetype o:spt="202.0" path="m,l,21600r21600,l21600,xe" coordsize="21600,21600" id="_x0000_t202">
                        <v:stroke joinstyle="miter"/>
                        <v:path gradientshapeok="t" o:connecttype="rect"/>
                    </v:shapetype>
                    <v:shape o:gfxdata="UEsDBB...QYAAAAABAAEAPMAAAD1BQAAAAA=" type="#_x0000_t202" style="position:absolute;margin-left:31.5pt;margin-top:51pt;width:69pt;height:80.25pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;v-text-anchor:top" id="Text Box 1" o:spid="_x0000_s1026" strokeweight=".5pt" fillcolor="white [3201]">
                        <v:textbox style="layout-flow:vertical-ideographic">
                            <w:txbxContent>
<w:p >
    <w:r>
        <w:t>Hello</w:t>
    </w:r>
</w:p>
                            </w:txbxContent>
                        </v:textbox>
                    </v:shape>
                </w:pict>
            </w:r>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


or the other direction (notice "rotation:180"):

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
            <w:r>
                <w:rPr>
                    <w:noProof/>
                    <w:lang w:eastAsia="ja-JP"/>
                </w:rPr>
                <w:pict>
                    <v:shapetype o:spt="202.0" path="m,l,21600r21600,l21600,xe" coordsize="21600,21600" id="_x0000_t202">
                        <v:stroke joinstyle="miter"/>
                        <v:path gradientshapeok="t" o:connecttype="rect"/>
                    </v:shapetype>
                    <v:shape o:gfxdata="UEsDBBQABgAIAAAAIQ...eG1sUEsFBgAAAAAEAAQA8wAAAAYGAAAAAA==" type="#_x0000_t202" style="position:absolute;margin-left:31.5pt;margin-top:51pt;width:69pt;height:80.25pt;rotation:180;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;v-text-anchor:top" id="Text Box 1" o:spid="_x0000_s1026" strokeweight=".5pt" fillcolor="white [3201]">
                        <v:textbox style="layout-flow:vertical-ideographic">
                            <w:txbxContent>
<w:p >
    <w:r>
        <w:t>Hello</w:t>
    </w:r>
</w:p>
                            </w:txbxContent>
                        </v:textbox>
                    </v:shape>
                </w:pict>
            </w:r>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


Generate corresponding code using the Word AddIn.