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

Free Support Forum - aspose.com

Text to Hyperlink

Hi

How can I change text in a word document to a hyperlink text using aspose .

Thanks

Hi Shinoj,


Thanks for your inquiry. I would suggest you to please visit the following link to be able to insert Hyperlinks in the document:
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.documentbuilder.inserthyperlink.html

I hope, this will help.

Best Regards,

I dont want to insert new hyper link. What I need is change an existing text from an existing document to hyper link;

For ex I need to change the text for each paragraph to the hyperlink;

foreach (Paragraph paragraph in paragraphs)

{

paragraph.Runs[0]..Text =

//@" HYPERLINK \\l 'toc' ";//" string.Format("HYPERLINK {0}\"{1}\"", ((mIsLocal) ? "\\l " : ""), paragraph.Runs[0].Text);

// paragraph.Runs[0].Text = "" + paragraph.Runs[0].Text + "";

}

Hi

Thanks for your request. I think, the code provided here could be useful for you:

Best regards,

Hi,


Thanks for the additional information. I think, in your case, the following code snippet should work:

DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>

Paragraph paragraph = (Paragraph)doc.GetChildNodes(NodeType.Paragraph, true)[0];

string linkText = paragraph.Runs[0].Text;

paragraph.Runs[0].Text = string.Empty;

builder.MoveToParagraph(0, 0);

builder.InsertHyperlink(linkText, "http://www.aspose.com", false);


Please let us know if you need more information, We are always glad to help you.

Best Regards,