// Assume P p // Create object for r R r = wmlObjectFactory.createR(); // Create object for object (wrapped in JAXBElement) CTObject object = wmlObjectFactory.createCTObject(); JAXBElement objectWrapped = wmlObjectFactory.createRObject(object); r.getContent().add( objectWrapped); // Create object for control CTControl control = wmlObjectFactory.createCTControl(); object.setControl(control); control.setName( "CheckBox1"); control.setShapeid( "_x0000_i1025"); control.setId( "rId5"); object.setDxaOrig( BigInteger.valueOf( 1440) ); object.setDyaOrig( BigInteger.valueOf( 1440) ); org.docx4j.vml.ObjectFactory vmlObjectFactory = new org.docx4j.vml.ObjectFactory(); // Create object for shapetype (wrapped in JAXBElement) CTShapetype shapetype = vmlObjectFactory.createCTShapetype(); JAXBElement shapetypeWrapped = vmlObjectFactory.createShapetype(shapetype); object.getAnyAndAny().add( shapetypeWrapped); // Create object for stroke (wrapped in JAXBElement) CTStroke stroke = vmlObjectFactory.createCTStroke(); JAXBElement strokeWrapped = vmlObjectFactory.createStroke(stroke); shapetype.getEGShapeElements().add( strokeWrapped); stroke.setJoinstyle(org.docx4j.vml.STStrokeJoinStyle.MITER); // Create object for formulas (wrapped in JAXBElement) CTFormulas formulas = vmlObjectFactory.createCTFormulas(); JAXBElement formulasWrapped = vmlObjectFactory.createFormulas(formulas); shapetype.getEGShapeElements().add( formulasWrapped); // Create object for f CTF f = vmlObjectFactory.createCTF(); formulas.getF().add( f); f.setEqn( "if lineDrawn pixelLineWidth 0"); // Create object for f CTF f2 = vmlObjectFactory.createCTF(); formulas.getF().add( f2); f2.setEqn( "sum @0 1 0"); // Create object for f CTF f3 = vmlObjectFactory.createCTF(); formulas.getF().add( f3); f3.setEqn( "sum 0 0 @1"); // Create object for f CTF f4 = vmlObjectFactory.createCTF(); formulas.getF().add( f4); f4.setEqn( "prod @2 1 2"); // Create object for f CTF f5 = vmlObjectFactory.createCTF(); formulas.getF().add( f5); f5.setEqn( "prod @3 21600 pixelWidth"); // Create object for f CTF f6 = vmlObjectFactory.createCTF(); formulas.getF().add( f6); f6.setEqn( "prod @3 21600 pixelHeight"); // Create object for f CTF f7 = vmlObjectFactory.createCTF(); formulas.getF().add( f7); f7.setEqn( "sum @0 0 1"); // Create object for f CTF f8 = vmlObjectFactory.createCTF(); formulas.getF().add( f8); f8.setEqn( "prod @6 1 2"); // Create object for f CTF f9 = vmlObjectFactory.createCTF(); formulas.getF().add( f9); f9.setEqn( "prod @7 21600 pixelWidth"); // Create object for f CTF f10 = vmlObjectFactory.createCTF(); formulas.getF().add( f10); f10.setEqn( "sum @8 21600 0"); // Create object for f CTF f11 = vmlObjectFactory.createCTF(); formulas.getF().add( f11); f11.setEqn( "prod @7 21600 pixelHeight"); // Create object for f CTF f12 = vmlObjectFactory.createCTF(); formulas.getF().add( f12); f12.setEqn( "sum @10 21600 0"); // Create object for path (wrapped in JAXBElement) CTPath path = vmlObjectFactory.createCTPath(); JAXBElement pathWrapped = vmlObjectFactory.createPath(path); shapetype.getEGShapeElements().add( pathWrapped); path.setGradientshapeok(org.docx4j.vml.STTrueFalse.T); path.setConnecttype(org.docx4j.vml.officedrawing.STConnectType.RECT); path.setExtrusionok(org.docx4j.vml.officedrawing.STTrueFalse.F); org.docx4j.vml.officedrawing.ObjectFactory vmlofficedrawingObjectFactory = new org.docx4j.vml.officedrawing.ObjectFactory(); // Create object for lock (wrapped in JAXBElement) CTLock lock = vmlofficedrawingObjectFactory.createCTLock(); JAXBElement lockWrapped = vmlofficedrawingObjectFactory.createLock(lock); shapetype.getEGShapeElements().add( lockWrapped); lock.setAspectratio(org.docx4j.vml.officedrawing.STTrueFalse.T); lock.setExt(org.docx4j.vml.STExt.EDIT); shapetype.setStroked(org.docx4j.vml.STTrueFalse.F); shapetype.setFilled(org.docx4j.vml.STTrueFalse.F); shapetype.setSpt( new Float(75.0) ); shapetype.setConnectortype(org.docx4j.vml.officedrawing.STConnectorType.STRAIGHT); shapetype.setPreferrelative(org.docx4j.vml.officedrawing.STTrueFalse.T); shapetype.setPath( "m@4@5l@4@11@9@11@9@5xe"); shapetype.setCoordsize( "21600,21600"); shapetype.setVmlId( "_x0000_t75"); shapetype.setHralign(org.docx4j.vml.officedrawing.STHrAlign.LEFT); shapetype.setInsetmode(org.docx4j.vml.officedrawing.STInsetMode.CUSTOM); // Create object for shape (wrapped in JAXBElement) CTShape shape = vmlObjectFactory.createCTShape(); JAXBElement shapeWrapped = vmlObjectFactory.createShape(shape); object.getAnyAndAny().add( shapeWrapped); shape.setVmlId( "_x0000_i1025"); shape.setType( "#_x0000_t75"); shape.setStyle( "width:108.3pt;height:20.75pt"); // Create object for imagedata (wrapped in JAXBElement) CTImageData imagedata = vmlObjectFactory.createCTImageData(); JAXBElement imagedataWrapped = vmlObjectFactory.createImagedata(imagedata); shape.getEGShapeElements().add( imagedataWrapped); imagedata.setId( "rId4"); imagedata.setTitle( ""); shape.setHralign(org.docx4j.vml.officedrawing.STHrAlign.LEFT); shape.setInsetmode(org.docx4j.vml.officedrawing.STInsetMode.CUSTOM); shape.setConnectortype(org.docx4j.vml.officedrawing.STConnectorType.STRAIGHT); shape.setOle( "");