I am using Aspose.Words to replace hyperlink. My requirement is to add text just after the hyperlink ends. I need help to achieve this.
Thanks for your inquiry. Please use the following code example to replace the hyperlink with new one and insert some text after the link. Hope this helps you.
Document doc = new Document(MyDir + "in.docx");
FieldHyperlink link = (FieldHyperlink)doc.Range.Fields[0];
//Replace hyperlink
link.Address = "https://www.aspose.com/";
link.Result = "Aspose";
//Add text after field.
Run run = new Run(doc);
run.Text = " Text after link";
link.End.ParentParagraph.InsertAfter(run, link.End);
doc.Save(MyDir + "18.1.docx");
1 Like