Page 1 of 1

Rotation of text within paragraph

PostPosted: Wed Mar 18, 2020 5:20 pm
by ppg04
I want to rotate text within R (org.docx4j.wml.R). The property scene3D of Rpr is of type org.docx4j.w14.CTScene3D and all the tags of w14 are ignored in the xml, due to which text rotation is not getting applied.

Code: Select all
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid wp14">


The document xml is as folows:
Code: Select all
                                 <w:r>
                                    <w:rPr>
                                       <w:rFonts w:ascii="Arial Regular" w:hAnsi="Arial Regular" w:cs="Arial Regular"/>
                                       <w:color w:val="000000"/>
                                       <w:sz w:val="18"/>
                                       <w14:scene3d>
                                          <w14:camera w14:prst="orthographicFront"/>
                                          <w14:lightRig w14:rig="threePt" w14:dir="t">
                                             <w14:rot w14:lat="0" w14:lon="0" w14:rev="1740000"/>
                                          </w14:lightRig>
                                       </w14:scene3d>
                                    </w:rPr>
                                    <w:t xml:space="preserve">zx czds cxvsd zsd </w:t>
                                 </w:r>


Please suggest the approach to handle this.

Re: Rotation of text within paragraph

PostPosted: Thu Mar 26, 2020 11:51 am
by jason
I experimented creating a docx in Word containing:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
      <w:r w:rsidRPr="00F3149B">
        <w:rPr>
          <w:sz w:val="48"/>
          <w:szCs w:val="48"/>
          <w14:shadow w14:blurRad="50800" w14:dist="50800" w14:dir="5400000" w14:sx="0" w14:sy="0" w14:kx="0" w14:ky="0" w14:algn="ctr">
            <w14:srgbClr w14:val="FF0000">
              <w14:alpha w14:val="36000"/>
            </w14:srgbClr>
          </w14:shadow>
          <w14:props3d w14:extrusionH="0" w14:contourW="0" w14:prstMaterial="warmMatte">
            <w14:bevelT w14:w="38100" w14:h="38100" w14:prst="circle"/>
          </w14:props3d>
        </w:rPr>
        <w:t>w</w:t>
      </w:r>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


However, there was nothing visibly different on the document surface in the Word UI...

I verified our current docx4j 8.1.x release round trips (ie loads/saves) these w14 namespace elements.

So perhaps you aren't seeing anything in the Word UI, like me? Your next step might be to create some w14 content in Word, which you can actually see there...

Re: Rotation of text within paragraph

PostPosted: Thu Mar 26, 2020 8:03 pm
by ppg04
Thanks for the details. I found solution for this issue. The rotation was not reflecting in the output because property set was not right. Instead of applying rotation to lightRig, I had to apply it for camera as shown below:
<wps:bodyPr vertOverflow="overflow" horzOverflow="overflow" vert="horz" anchor="t">
<a:scene3d>
<a:camera prst="orthographicFront">
<a:rot lat="0" lon="0" rev="18900000"/>
</a:camera>
<a:lightRig rig="threePt" dir="t"/>
</a:scene3d>
</wps:bodyPr>