Page 1 of 1

Does Docx4j / XLSX4J support Image Skew property?

PostPosted: Wed Dec 04, 2019 5:28 pm
by ashanaik
Does Docx4j /XLSX4J support Image Skew property?

Re: Does Docx4j / XLSX4J support Image Skew property?

PostPosted: Thu Dec 05, 2019 7:17 am
by jason
Please don't post the same question multiple times. It would be more helpful to be clear as to whether you want this in docx or xlsx files or both, and to include a sample file giving an example of what you mean.

Re: Does Docx4j / XLSX4J support Image Skew property?

PostPosted: Thu Dec 05, 2019 11:46 pm
by ashanaik
Image SKew
Image_skew.PNG (13.07 KiB) Viewed 451 times

Hi Jason

Please find the attached png file with image skew property. Here the image has skew angle of 50 degree.
Basically the image inside frame is tilted and not the entire frame(not setRot in Xfrm)
This property is applicable in pdf.

I want to know if there is any way to apply such property to images in docx , pptx and xlxs4j.

Thanks !

Re: Does Docx4j / XLSX4J support Image Skew property?

PostPosted: Fri Dec 06, 2019 8:37 am
by jason
You need to provide a docx pptx and/or xlsx in which skew has been applied within the Office application to the image. Instructions as to how to do it would also be useful.

If you can't do it in Office, you can't do it in docx4j.

If you can do it in Office, you can probably apply the same setting using docx4j.

As far as I can tell, there is no "skew" option for images in Word or Powerpoint, but you can achieve something similar using its 3D rotation interface. Once you have created an example (in Word say), you can use the Docx4j Helper AddIn for Word, or docx4j webapp, to generate corresponding code. The XML for my example included:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
                            <a:graphicData uri="">
                                <pic:pic xmlns:pic="">
                                        <pic:cNvPr id="1" name=""/>
                                        <a:blip xmlns:r="" r:embed="rId4"/>
                                            <a:off x="0" y="0"/>
                                            <a:ext cx="5427178" cy="2888660"/>
                                        <a:prstGeom prst="rect">
                                            <a:camera prst="orthographicFront">
                                                <a:rot lat="20309688" lon="18723851" rev="611854"/>
                                            <a:lightRig dir="t" rig="threePt"/>
                                        <a:sp3d z="63500"/>
Parsed in 0.003 seconds, using GeSHi

Note scene3d and sp3d elements.

For that bit the corresponding code is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting

import org.docx4j.dml.CTScene3D;
import org.docx4j.dml.CTShape3D;
                                        // Create object for scene3D
                                        CTScene3D scene3d = dmlObjectFactory.createCTScene3D();
                                            // Create object for camera
                                            CTCamera camera = dmlObjectFactory.createCTCamera();
                                                // Create object for rot
                                                CTSphereCoords spherecoords = dmlObjectFactory.createCTSphereCoords();
                                                    spherecoords.setLat( 20309688 );
                                                    spherecoords.setLon( 18723851 );
                                                    spherecoords.setRev( 611854 );
                                                camera.setZoom( new Integer(100000) );
                                            // Create object for lightRig
                                            CTLightRig lightrig = dmlObjectFactory.createCTLightRig();
                                        // Create object for sp3D
                                        CTShape3D shape3d = dmlObjectFactory.createCTShape3D();
                                            shape3d.setZ( new Long(63500) );
                                            shape3d.setExtrusionH( new Long(0) );
                                            shape3d.setContourW( new Long(0) );
Parsed in 0.019 seconds, using GeSHi

There is also skew in VML, ... nxml-2.8.1

This element specifies a perspective skew effect on a shape. The skew is applied to vector graphics, not image data on the shape in picture fills or image elements. The on attribute shall be true and a permitted value assigned to the matrix attribute.

but I guess you are working with bit-mapped images?

Re: Does Docx4j / XLSX4J support Image Skew property?

PostPosted: Mon Dec 09, 2019 4:57 pm
by ashanaik
Hi Jason

Thanks for the reply.

Even i checked ,there is no direct image skew property supported in excel, 3D implementation is whats close to skew property.