protected CTShape newCommentShape(){ CTShape shape = CTShape.Factory.newInstance(); shape.setId("_x0000_s" + (++_shapeId)); shape.setType("#" + _shapeTypeId); shape.setStyle("position:absolute; visibility:hidden"); shape.setFillcolor("#ffffe1"); shape.setInsetmode(STInsetMode.AUTO); shape.addNewFill().setColor("#ffffe1"); CTShadow shadow = shape.addNewShadow(); shadow.setOn(STTrueFalse.T); shadow.setColor("black"); shadow.setObscured(STTrueFalse.T); shape.addNewPath().setConnecttype(STConnectType.NONE); shape.addNewTextbox().setStyle("mso-direction-alt:auto"); CTClientData cldata = shape.addNewClientData(); cldata.setObjectType(STObjectType.NOTE); cldata.addNewMoveWithCells(); cldata.addNewSizeWithCells(); cldata.addNewAnchor().setStringValue("1, 15, 0, 2, 3, 15, 3, 16"); cldata.addNewAutoFill().setStringValue("False"); cldata.addNewRow().setBigIntegerValue(new BigInteger("0")); cldata.addNewColumn().setBigIntegerValue(new BigInteger("0")); _items.add(shape); _qnames.add(QNAME_SHAPE); return shape; }
shape.setStyle("position:absolute;margin-left:0;margin-top:0;width:415pt;height:207.5pt;z-index:-251654144;mso-wrap-edited:f;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin"); shape.setWrapcoords("616 5068 390 16297 39 16921 -39 17155 7265 17545 7186 17467 -39 17467 18904 17467 10507 17467 8710 17545 18904 17077 18787 16843 18358 16297 18279 12554 19178 12476 20701 11774 20779 11228 21131 10059 21248 8811 21248 7563 20975 6316 20935 5380 19490 5146 14022 5068 2616 5068"); shape.setFillcolor("black"); shape.setStroked(STTrueFalse.FALSE); CTTextPath shapeTextPath = shape.addNewTextpath();
private void addWaterMark(Object obj, String watermark, String color) { if (obj instanceof XWPFDocument) { XWPFDocument doc = (XWPFDocument) obj; // create header-footer XWPFHeaderFooterPolicy headerFooterPolicy = doc.getHeaderFooterPolicy(); if (headerFooterPolicy == null) headerFooterPolicy = doc.createHeaderFooterPolicy(); // create default Watermark - fill color black and not rotated headerFooterPolicy.createWatermark(watermark); // get the default header // Note: createWatermark also sets FIRST and EVEN headers // but this code does not updating those other headers XWPFHeader header = headerFooterPolicy.getHeader(XWPFHeaderFooterPolicy.DEFAULT); XWPFParagraph paragraph = header.getParagraphArray(0); // get com.microsoft.schemas.vml.CTShape where fill color and rotation is set XmlObject[] xmlobjects = paragraph.getCTP().getRArray(0).getPictArray(0).selectChildren(new QName("urn:schemas-microsoft-com:vml", "shape")); if (xmlobjects.length > 0) { com.microsoft.schemas.vml.CTShape ctshape = (com.microsoft.schemas.vml.CTShape)xmlobjects[0]; // set fill color ctshape.setFillcolor(color); // set rotation ctshape.setStyle(ctshape.getStyle() + ";rotation:315"); } } else if (obj instanceof HWPFDocument) { } } }
protected CTShape newCommentShape(){ CTShape shape = CTShape.Factory.newInstance(); shape.setId("_x0000_s" + (++_shapeId)); shape.setType("#" + _shapeTypeId); shape.setStyle("position:absolute; visibility:hidden"); shape.setFillcolor("#ffffe1"); shape.setInsetmode(STInsetMode.AUTO); shape.addNewFill().setColor("#ffffe1"); CTShadow shadow = shape.addNewShadow(); shadow.setOn(STTrueFalse.T); shadow.setColor("black"); shadow.setObscured(STTrueFalse.T); shape.addNewPath().setConnecttype(STConnectType.NONE); shape.addNewTextbox().setStyle("mso-direction-alt:auto"); CTClientData cldata = shape.addNewClientData(); cldata.setObjectType(STObjectType.NOTE); cldata.addNewMoveWithCells(); cldata.addNewSizeWithCells(); cldata.addNewAnchor().setStringValue("1, 15, 0, 2, 3, 15, 3, 16"); cldata.addNewAutoFill().setStringValue("False"); cldata.addNewRow().setBigIntegerValue(new BigInteger("0")); cldata.addNewColumn().setBigIntegerValue(new BigInteger("0")); _items.add(shape); _qnames.add(QNAME_SHAPE); return shape; }
shape.setStyle("position:absolute;margin-left:0;margin-top:0;width:415pt;height:207.5pt;z-index:-251654144;mso-wrap-edited:f;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin"); shape.setWrapcoords("616 5068 390 16297 39 16921 -39 17155 7265 17545 7186 17467 -39 17467 18904 17467 10507 17467 8710 17545 18904 17077 18787 16843 18358 16297 18279 12554 19178 12476 20701 11774 20779 11228 21131 10059 21248 8811 21248 7563 20975 6316 20935 5380 19490 5146 14022 5068 2616 5068"); shape.setFillcolor("black"); shape.setStroked(STTrueFalse.FALSE); CTTextPath shapeTextPath = shape.addNewTextpath();