I'm trying to find a solution to add hyperlink to a paragraph.
When I do something, like this:
- Code: Select all
...
String hpl = "<w:p xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " +
"xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" >" +
"<w:hyperlink r:id=\"rId" + counter + "\">" +
"<w:r>" +
"<w:rPr>" +
"<w:rStyle w:val=\"Title\" />" +
"</w:rPr>" +
"<w:t>Link</w:t>" +
"</w:r>" +
"</w:hyperlink>" +
"</w:p>";
// wmlPack is WordprocessingMLPackage
wmlPack.getMainDocumentPart().addObject(XmlUtils.unmarshalString(hpl));
, it works fine, but if I need insert hyperlink into existing paragraph: ...