public XDDFHyperlink(String id) { this(CTHyperlink.Factory.newInstance()); this.link.setId(id); }
private void linkToRelativeSlide(String jump) { PackagePart thisPP = _sheet.getPackagePart(); if (_link.isSetId() && !_link.getId().isEmpty()) { thisPP.removeRelationship(_link.getId()); } _link.setId(""); _link.setAction((jump.startsWith("ppaction") ? "" : "ppaction://hlinkshowjump?jump=") + jump); } }
@Override public void linkToSlide(Slide<XSLFShape,XSLFTextParagraph> slide) { if (_link.isSetId() && !_link.getId().isEmpty()) { _sheet.getPackagePart().removeRelationship(_link.getId()); } RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, (XSLFSheet) slide); _link.setId(rp.getRelationship().getId()); _link.setAction("ppaction://hlinksldjump"); }
private void linkToExternal(String url) { PackagePart thisPP = _sheet.getPackagePart(); if (_link.isSetId() && !_link.getId().isEmpty()) { thisPP.removeRelationship(_link.getId()); } PackageRelationship rel = thisPP.addExternalRelationship(url, XSLFRelation.HYPERLINK.getRelation()); _link.setId(rel.getId()); if (_link.isSetAction()) { _link.unsetAction(); } }
if (pp != null) { RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, pp); _link.setId(rp.getRelationship().getId()); _link.setAction(src._link.getAction());
public XDDFHyperlink(String id) { this(CTHyperlink.Factory.newInstance()); this.link.setId(id); }
PackageRelationship rel = ((XSSFDrawing)patriarch).getPackagePart().addRelationship( new URI("http://poi.apache.org"), TargetMode.EXTERNAL, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"); ((XSSFDrawing)patriarch).addRelation(rel.getId(),new POIXMLDocumentPart()); CTPictureNonVisual nvPicPr = ((XSSFPicture)picture).getCTPicture().getNvPicPr(); CTHyperlink hLinkClick = nvPicPr.getCNvPr().addNewHlinkClick(); hLinkClick.setId(rel.getId());
private void linkToRelativeSlide(String jump) { PackagePart thisPP = _sheet.getPackagePart(); if (_link.isSetId() && !_link.getId().isEmpty()) { thisPP.removeRelationship(_link.getId()); } _link.setId(""); _link.setAction((jump.startsWith("ppaction") ? "" : "ppaction://hlinkshowjump?jump=") + jump); } }
private void linkToExternal(String url) { PackagePart thisPP = _sheet.getPackagePart(); if (_link.isSetId() && !_link.getId().isEmpty()) { thisPP.removeRelationship(_link.getId()); } PackageRelationship rel = thisPP.addExternalRelationship(url, XSLFRelation.HYPERLINK.getRelation()); _link.setId(rel.getId()); if (_link.isSetAction()) { _link.unsetAction(); } }
@Override public void linkToSlide(Slide<XSLFShape,XSLFTextParagraph> slide) { if (_link.isSetId() && !_link.getId().isEmpty()) { _sheet.getPackagePart().removeRelationship(_link.getId()); } RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, (XSLFSheet) slide); _link.setId(rp.getRelationship().getId()); _link.setAction("ppaction://hlinksldjump"); }
public void setAddress(String address){ XSLFSheet sheet = _r.getParentParagraph().getParentShape().getSheet(); PackageRelationship rel = sheet.getPackagePart(). addExternalRelationship(address, XSLFRelation.HYPERLINK.getRelation()); _link.setId(rel.getId()); }
public void example() throws Exception{ XWPFDocument document = new XWPFDocument(); //Append a link to appendExternalHyperlink("https://poi.apache.org", " Link to POI", document.createParagraph()); document.write(new FileOutputStream("resultat.docx")); } /** * Appends an external hyperlink to the paragraph. * * @param url The URL to the external target * @param text The linked text * @param paragraph the paragraph the link will be appended to. */ public static void appendExternalHyperlink(String url, String text, XWPFParagraph paragraph){ //Add the link as External relationship String id=paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); //Append the link and bind it to the relationship CTHyperlink cLink=paragraph.getCTP().addNewHyperlink(); cLink.setId(id); //Create the linked text CTText ctText=CTText.Factory.newInstance(); ctText.setStringValue(text); CTR ctr=CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); //Insert the linked text into the link cLink.setRArray(new CTR[]{ctr}); }
public void setAddress(XSLFSlide slide){ XSLFSheet sheet = _r.getParentParagraph().getParentShape().getSheet(); PackageRelationship rel = sheet.getPackagePart(). addRelationship(slide.getPackagePart().getPartName(), TargetMode.INTERNAL, XSLFRelation.SLIDE.getRelation()); _link.setId(rel.getId()); _link.setAction("ppaction://hlinksldjump"); }
if (pp != null) { RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, pp); _link.setId(rp.getRelationship().getId()); _link.setAction(src._link.getAction());