@Override public XSLFHyperlink getHyperlink() { CTNonVisualDrawingProps cNvPr = getCNvPr(); if (!cNvPr.isSetHlinkClick()) { return null; } return new XSLFHyperlink(cNvPr.getHlinkClick(), getSheet()); }
public XWPFPicture(CTPicture ctPic, XWPFRun run) { this.run = run; this.ctPic = ctPic; description = ctPic.getNvPicPr().getCNvPr().getDescr(); }
/** * @param shapeId 1-based shapeId */ static CTGroupShape prototype(int shapeId) { CTGroupShape ct = CTGroupShape.Factory.newInstance(); CTGroupShapeNonVisual nvSpPr = ct.addNewNvGrpSpPr(); CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr(); cnv.setName("Group " + shapeId); cnv.setId(shapeId); nvSpPr.addNewCNvGrpSpPr(); nvSpPr.addNewNvPr(); ct.addNewGrpSpPr(); return ct; }
nvp.setId(1); nvp.setName("Shape 1"); CTOfficeArtExtensionList extLst = nvp.addNewExtLst();
/** * Sets the frame id. */ protected void setId(long id) { graphicFrame.getNvGraphicFramePr().getCNvPr().setId(id); }
/** * Sets the frame name. */ public void setName(String name) { getNonVisualProperties().setName(name); }
/** * Returns the frame name. * @return name of the frame */ public String getName() { return getNonVisualProperties().getName(); }
@Override public int getShapeId() { return (int)getCNvPr().getId(); }
private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException { if (ctShape == null) return; CTShapeNonVisual nvSpPR = ctShape.getNvSpPr(); if (nvSpPR == null) return; CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr(); if (cNvPr == null) return; CTHyperlink ctHyperlink = cNvPr.getHlinkClick(); if (ctHyperlink == null) return; String url = drawingHyperlinks.get(ctHyperlink.getId()); if (url != null) { xhtml.startElement("a", "href", url); xhtml.characters(url); xhtml.endElement("a"); } CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover(); if (ctHoverHyperlink == null) return; url = drawingHyperlinks.get(ctHoverHyperlink.getId()); if (url != null) { xhtml.startElement("a", "href", url); xhtml.characters(url); xhtml.endElement("a"); } }
/** * @param shapeId * 1-based shapeId */ static CTShape prototype(int shapeId) { CTShape ct = CTShape.Factory.newInstance(); CTShapeNonVisual nvSpPr = ct.addNewNvSpPr(); CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr(); cnv.setName("AutoShape " + shapeId); cnv.setId(shapeId); nvSpPr.addNewCNvSpPr(); nvSpPr.addNewNvPr(); CTShapeProperties spPr = ct.addNewSpPr(); CTPresetGeometry2D prst = spPr.addNewPrstGeom(); prst.setPrst(STShapeType.RECT); prst.addNewAvLst(); return ct; }
/** * Constructs a textbox under the drawing. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created textbox. */ public XSSFTextBox createTextbox(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); XSSFTextBox shape = new XSSFTextBox(this, ctShape); shape.anchor = anchor; return shape; }
/** * Sets the frame name. */ public void setName(String name) { getNonVisualProperties().setName(name); }
@Override public String getShapeName(){ return getCNvPr().getName(); }
/** * Gets the frame id. */ public long getId() { return graphicFrame.getNvGraphicFramePr().getCNvPr().getId(); }
private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException { if (ctShape == null) return; CTShapeNonVisual nvSpPR = ctShape.getNvSpPr(); if (nvSpPR == null) return; CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr(); if (cNvPr == null) return; CTHyperlink ctHyperlink = cNvPr.getHlinkClick(); if (ctHyperlink == null) return; String url = drawingHyperlinks.get(ctHyperlink.getId()); if (url != null) { xhtml.startElement("a", "href", url); xhtml.characters(url); xhtml.endElement("a"); } CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover(); if (ctHoverHyperlink == null) return; url = drawingHyperlinks.get(ctHoverHyperlink.getId()); if (url != null) { xhtml.startElement("a", "href", url); xhtml.characters(url); xhtml.endElement("a"); } }
/** * Creates a simple shape. This includes such shapes as lines, rectangles, * and ovals. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created shape. */ public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); ctShape.getSpPr().setXfrm(createXfrm(anchor)); XSSFSimpleShape shape = new XSSFSimpleShape(this, ctShape); shape.anchor = anchor; return shape; }