import java.lang.Integer;
import java.lang.Long;
import javax.xml.bind.JAXBElement;
import org.docx4j.dml.CTBlip;
import org.docx4j.dml.CTBlipFillProperties;
import org.docx4j.dml.CTGeomGuideList;
import org.docx4j.dml.CTGraphicalObjectFrameLocking;
import org.docx4j.dml.CTLineProperties;
import org.docx4j.dml.CTNoFillProperties;
import org.docx4j.dml.CTNonVisualDrawingProps;
import org.docx4j.dml.CTNonVisualGraphicFrameProperties;
import org.docx4j.dml.CTNonVisualPictureProperties;
import org.docx4j.dml.CTOfficeArtExtension;
import org.docx4j.dml.CTOfficeArtExtensionList;
import org.docx4j.dml.CTPictureLocking;
import org.docx4j.dml.CTPoint2D;
import org.docx4j.dml.CTPositiveSize2D;
import org.docx4j.dml.CTPresetGeometry2D;
import org.docx4j.dml.CTRelativeRect;
import org.docx4j.dml.CTShapeProperties;
import org.docx4j.dml.CTStretchInfoProperties;
import org.docx4j.dml.CTTransform2D;
import org.docx4j.dml.Graphic;
import org.docx4j.dml.GraphicData;
import org.docx4j.dml.picture.CTPictureNonVisual;
import org.docx4j.dml.picture.Pic;
import org.docx4j.dml.wordprocessingDrawing.Anchor;
import org.docx4j.dml.wordprocessingDrawing.CTEffectExtent;
import org.docx4j.dml.wordprocessingDrawing.CTPosH;
import org.docx4j.dml.wordprocessingDrawing.CTPosV;
import org.docx4j.dml.wordprocessingDrawing.CTWrapPath;
import org.docx4j.dml.wordprocessingDrawing.CTWrapTight;
public class Foo
{
public Anchor createIt
() {
org.
docx4j.
dml.
wordprocessingDrawing.
ObjectFactory dmlwordprocessingDrawingObjectFactory
= new org.
docx4j.
dml.
wordprocessingDrawing.
ObjectFactory();
Anchor anchor
= dmlwordprocessingDrawingObjectFactory.
createAnchor();
// Create object for wrapTight
CTWrapTight wraptight
= dmlwordprocessingDrawingObjectFactory.
createCTWrapTight();
anchor.
setWrapTight(wraptight
);
wraptight.
setWrapText(org.
docx4j.
dml.
wordprocessingDrawing.
STWrapText.
BOTH_SIDES);
// Create object for wrapPolygon
CTWrapPath wrappath
= dmlwordprocessingDrawingObjectFactory.
createCTWrapPath();
wraptight.
setWrapPolygon(wrappath
);
org.
docx4j.
dml.
ObjectFactory dmlObjectFactory
= new org.
docx4j.
dml.
ObjectFactory();
// Create object for lineTo
CTPoint2D point2d
= dmlObjectFactory.
createCTPoint2D();
wrappath.
getLineTo().
add( point2d
);
point2d.
setY( 21127
);
point2d.
setX( 0
);
// Create object for lineTo
CTPoint2D point2d2
= dmlObjectFactory.
createCTPoint2D();
wrappath.
getLineTo().
add( point2d2
);
point2d2.
setY( 21127
);
point2d2.
setX( 21413
);
// Create object for lineTo
CTPoint2D point2d3
= dmlObjectFactory.
createCTPoint2D();
wrappath.
getLineTo().
add( point2d3
);
point2d3.
setY( 0
);
point2d3.
setX( 21413
);
// Create object for lineTo
CTPoint2D point2d4
= dmlObjectFactory.
createCTPoint2D();
wrappath.
getLineTo().
add( point2d4
);
point2d4.
setY( 0
);
point2d4.
setX( 0
);
// Create object for start
CTPoint2D point2d5
= dmlObjectFactory.
createCTPoint2D();
wrappath.
setStart(point2d5
);
point2d5.
setY( 0
);
point2d5.
setX( 0
);
// Create object for docPr
CTNonVisualDrawingProps nonvisualdrawingprops
= dmlObjectFactory.
createCTNonVisualDrawingProps();
anchor.
setDocPr(nonvisualdrawingprops
);
nonvisualdrawingprops.
setDescr( "http://louisianalawblog.wp.lexblogs.com/wp-content/uploads/sites/342/2015/02/app.jpg");
nonvisualdrawingprops.
setName( "Picture 1");
nonvisualdrawingprops.
setId( 1
);
// Create object for cNvGraphicFramePr
CTNonVisualGraphicFrameProperties nonvisualgraphicframeproperties
= dmlObjectFactory.
createCTNonVisualGraphicFrameProperties();
anchor.
setCNvGraphicFramePr(nonvisualgraphicframeproperties
);
// Create object for graphicFrameLocks
CTGraphicalObjectFrameLocking graphicalobjectframelocking
= dmlObjectFactory.
createCTGraphicalObjectFrameLocking();
nonvisualgraphicframeproperties.
setGraphicFrameLocks(graphicalobjectframelocking
);
// Create object for graphic
Graphic graphic
= dmlObjectFactory.
createGraphic();
anchor.
setGraphic(graphic
);
// Create object for graphicData
GraphicData graphicdata
= dmlObjectFactory.
createGraphicData();
graphic.
setGraphicData(graphicdata
);
graphicdata.
setUri( "http://schemas.openxmlformats.org/drawingml/2006/picture");
org.
docx4j.
dml.
picture.
ObjectFactory dmlpictureObjectFactory
= new org.
docx4j.
dml.
picture.
ObjectFactory();
// Create object for pic (wrapped in JAXBElement)
Pic pic
= dmlpictureObjectFactory.
createPic();
JAXBElement
<org.
docx4j.
dml.
picture.
Pic> picWrapped
= dmlpictureObjectFactory.
createPic(pic
);
graphicdata.
getAny().
add( picWrapped
);
// Create object for blipFill
CTBlipFillProperties blipfillproperties
= dmlObjectFactory.
createCTBlipFillProperties();
pic.
setBlipFill(blipfillproperties
);
// Create object for blip
CTBlip blip
= dmlObjectFactory.
createCTBlip();
blipfillproperties.
setBlip(blip
);
blip.
setEmbed( "rId4");
// Create object for extLst
CTOfficeArtExtensionList officeartextensionlist
= dmlObjectFactory.
createCTOfficeArtExtensionList();
blip.
setExtLst(officeartextensionlist
);
// Create object for ext
CTOfficeArtExtension officeartextension
= dmlObjectFactory.
createCTOfficeArtExtension();
officeartextensionlist.
getExt().
add( officeartextension
);
officeartextension.
setUri( "{28A0092B-C50C-407E-A947-70E740481C1C}");
blip.
setCstate(org.
docx4j.
dml.
STBlipCompression.
NONE);
blip.
setLink( "");
// Create object for srcRect
CTRelativeRect relativerect
= dmlObjectFactory.
createCTRelativeRect();
blipfillproperties.
setSrcRect(relativerect
);
relativerect.
setT( new Integer(0
) );
relativerect.
setL( new Integer(0
) );
relativerect.
setR( new Integer(0
) );
relativerect.
setB( new Integer(0
) );
// Create object for stretch
CTStretchInfoProperties stretchinfoproperties
= dmlObjectFactory.
createCTStretchInfoProperties();
blipfillproperties.
setStretch(stretchinfoproperties
);
// Create object for fillRect
CTRelativeRect relativerect2
= dmlObjectFactory.
createCTRelativeRect();
stretchinfoproperties.
setFillRect(relativerect2
);
relativerect2.
setT( new Integer(0
) );
relativerect2.
setL( new Integer(0
) );
relativerect2.
setR( new Integer(0
) );
relativerect2.
setB( new Integer(0
) );
// Create object for spPr
CTShapeProperties shapeproperties
= dmlObjectFactory.
createCTShapeProperties();
pic.
setSpPr(shapeproperties
);
// Create object for noFill
CTNoFillProperties nofillproperties
= dmlObjectFactory.
createCTNoFillProperties();
shapeproperties.
setNoFill(nofillproperties
);
// Create object for xfrm
CTTransform2D transform2d
= dmlObjectFactory.
createCTTransform2D();
shapeproperties.
setXfrm(transform2d
);
// Create object for ext
CTPositiveSize2D positivesize2d
= dmlObjectFactory.
createCTPositiveSize2D();
transform2d.
setExt(positivesize2d
);
positivesize2d.
setCx( 1903016
);
positivesize2d.
setCy( 1304925
);
transform2d.
setRot( new Integer(0
) );
// Create object for off
CTPoint2D point2d6
= dmlObjectFactory.
createCTPoint2D();
transform2d.
setOff(point2d6
);
point2d6.
setY( 0
);
point2d6.
setX( 0
);
// Create object for ln
CTLineProperties lineproperties
= dmlObjectFactory.
createCTLineProperties();
shapeproperties.
setLn(lineproperties
);
// Create object for noFill
CTNoFillProperties nofillproperties2
= dmlObjectFactory.
createCTNoFillProperties();
lineproperties.
setNoFill(nofillproperties2
);
shapeproperties.
setBwMode(org.
docx4j.
dml.
STBlackWhiteMode.
AUTO);
// Create object for prstGeom
CTPresetGeometry2D presetgeometry2d
= dmlObjectFactory.
createCTPresetGeometry2D();
shapeproperties.
setPrstGeom(presetgeometry2d
);
// Create object for avLst
CTGeomGuideList geomguidelist
= dmlObjectFactory.
createCTGeomGuideList();
presetgeometry2d.
setAvLst(geomguidelist
);
presetgeometry2d.
setPrst(org.
docx4j.
dml.
STShapeType.
RECT);
// Create object for nvPicPr
CTPictureNonVisual picturenonvisual
= dmlpictureObjectFactory.
createCTPictureNonVisual();
pic.
setNvPicPr(picturenonvisual
);
// Create object for cNvPicPr
CTNonVisualPictureProperties nonvisualpictureproperties
= dmlObjectFactory.
createCTNonVisualPictureProperties();
picturenonvisual.
setCNvPicPr(nonvisualpictureproperties
);
// Create object for picLocks
CTPictureLocking picturelocking
= dmlObjectFactory.
createCTPictureLocking();
nonvisualpictureproperties.
setPicLocks(picturelocking
);
// Create object for cNvPr
CTNonVisualDrawingProps nonvisualdrawingprops2
= dmlObjectFactory.
createCTNonVisualDrawingProps();
picturenonvisual.
setCNvPr(nonvisualdrawingprops2
);
nonvisualdrawingprops2.
setDescr( "http://louisianalawblog.wp.lexblogs.com/wp-content/uploads/sites/342/2015/02/app.jpg");
nonvisualdrawingprops2.
setName( "Picture 1");
nonvisualdrawingprops2.
setId( 0
);
anchor.
setDistT( new Long(0
) );
anchor.
setDistB( new Long(0
) );
anchor.
setDistL( new Long(114300
) );
anchor.
setDistR( new Long(114300
) );
anchor.
setRelativeHeight( 251658240
);
// Create object for simplePos
CTPoint2D point2d7
= dmlObjectFactory.
createCTPoint2D();
anchor.
setSimplePos(point2d7
);
point2d7.
setY( 0
);
point2d7.
setX( 0
);
// Create object for positionH
CTPosH posh
= dmlwordprocessingDrawingObjectFactory.
createCTPosH();
anchor.
setPositionH(posh
);
posh.
setRelativeFrom(org.
docx4j.
dml.
wordprocessingDrawing.
STRelFromH.
COLUMN);
posh.
setPosOffset( new Integer(4152900
) );
// Create object for positionV
CTPosV posv
= dmlwordprocessingDrawingObjectFactory.
createCTPosV();
anchor.
setPositionV(posv
);
posv.
setRelativeFrom(org.
docx4j.
dml.
wordprocessingDrawing.
STRelFromV.
PARAGRAPH);
posv.
setPosOffset( new Integer(0
) );
// Create object for extent
CTPositiveSize2D positivesize2d2
= dmlObjectFactory.
createCTPositiveSize2D();
anchor.
setExtent(positivesize2d2
);
positivesize2d2.
setCx( 1903016
);
positivesize2d2.
setCy( 1304925
);
// Create object for effectExtent
CTEffectExtent effectextent
= dmlwordprocessingDrawingObjectFactory.
createCTEffectExtent();
anchor.
setEffectExtent(effectextent
);
effectextent.
setT( 0
);
effectextent.
setL( 0
);
effectextent.
setR( 2540
);
effectextent.
setB( 0
);
return anchor
;
}
}
Parsed in 0.043 seconds, using
GeSHi 1.0.8.4