Convert Run to Hyperlink

Is it possible to easily apply a hyperlink to a Run that already exists within a Document?

Hi Alex,

Thanks for your inquiry. Please use the following code snippet to achieve your requirements. The following code example gets the first Run node of second Paragraph in the document and insert hyperlink. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");

DocumentBuilder builder = new DocumentBuilder(doc);
// Get second paragraph of document
Paragraph para = (Paragraph) doc.getChild(NodeType.PARAGRAPH, 1, true);
// Get first Run node
Run run = (Run) para.getChild(NodeType.RUN, 0, true);
builder.moveTo(run);
builder.getFont().setStyleIdentifier(StyleIdentifier.HYPERLINK);
builder.insertHyperlink(run.getText(), "http://www.aspose.com/", false);
run.remove();
doc.save(MyDir + "Out.docx");