Replace a link in word document

Hi there,
I'm using DocIO to generate documents using a Word document as a template. Mail merge works great, but I have one problem that I can't solve.
In my document, I have an image with a hyperlink. I need to replace the link with a different one.
For example, I have an image with the hyperlink "https://www.google.com" and I want to replace it with "https://www.syncfusion.com"

I've opened the docx file in zip and I was able to find the hyperlink in word\_rels\document.xml.rels file, but I'd like to use your library instead on opening file as zip in the code.

Best regards,
Tomasz

Attachment: Template_with_link_71f174c9.zip

3 Replies 1 reply marked as answer

LB Lokesh Baskar Syncfusion Team June 17, 2021 02:26 PM UTC

Hi Tomasz,

Thank you for contacting Syncfusion support.

From the given details, we have found that your requirement is to replace the hyperlink of image. To achieve your requirement, we have prepared the sample application and it can be downloaded from the below link:
https://www.syncfusion.com/downloads/support/forum/166415/ze/DocIOSample-2144830511.zip  

In the above sample, we have done the following things,
1. Load the Word document.
2. Iterates the image with hyperlink and modified the hyperlink for a particular image as we need.
3. Save the document.

Please let us know if you have any other questions.

Regards,
Lokesh B


Marked as answer

TJ Tomasz Jagusz June 17, 2021 03:14 PM UTC

Hi Lokesh,

thank you for such a fast reply and for the provided sample.
I'll try to use your approach in my application. If I find any problems I'll post back.

Best regards,
Tomasz


LB Lokesh Baskar Syncfusion Team June 18, 2021 05:29 AM UTC

Hi Tomasz,

Thank you for your update.

We will wait until hear back from you.

Regards,
Lokesh B


Loader.
Up arrow icon