i try to add a hyperlink into a paragraph but it does not work.
This is my Code:
- Code: Select all
private P.Hyperlink createHyperlink(String target, String text)
{
//... creating Relationship with addRelationship() ...
P.Hyperlink hyperlink = this.objectFactory.createPHyperlink();
hyperlink.setId(relationship.getId());
R run = this.objectFactory.createR();
RPr runProperties = this.objectFactory.createRPr();
RStyle styleValue = this.objectFactory.createRStyle();
styleValue.setVal("Hyperlink");
runProperties.setRStyle(styleValue);
run.setRPr(runProperties);
Text xmlText = this.objectFactory.createText();
xmlText.setValue(text);
run.getRunContent().add(xmlText);
hyperlink.getParagraphContent().add(run);
return hyperlink;
}
P.Hyperlink hyperlink = this.createHyperlink("destination.docx", "text");
//create paragraph and add the hyperlink ...