We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document(MyDir

  • “in.docx”);<o:p></o:p>

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.insertHyperlink(run.getText(), "http://www.aspose.com/", false);


doc.save(MyDir + "Out.docx");