We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Replace Image tag with Mail Merge Field

Thread ID:

Created:

Updated:

Platform:

Replies:

103666 May 23,2012 11:40 AM UTC Jan 2,2013 04:38 AM UTC ASP.NET Web Forms (Classic) 8
loading
Tags: DocIO
Naman Ahuja
Asked On May 23, 2012 11:40 AM UTC

Hi all,

I am converting html to word. Html content contains image tag , i want to replace that image tag with those of the mailmerge fields.
can someone suggest a way to do that.

thanks in advance!

Gunasekaran T [Syncfusion]
Replied On May 24, 2012 05:16 AM UTC

Hi Naman,

Thank you for your interest in Syncfusion products.

We have prepared the sample to illustrate your requirement to replace Image tag with Mail Merge field using DocIO. Please do find the sample from the attachment. Try running the sample and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Sample_9d64883.zip

Naman Ahuja
Replied On May 24, 2012 10:50 AM UTC

HI  Gunasekaran ,

thanks for the help but wanted to ask one more things,
how can i insert merge field at a specific position.
supposedly  i have some text and i want to replace it with that of the merge fields , it is possible to do that ?
if yes then how can i do that.?

thanks !!


Naman Ahuja
Replied On May 24, 2012 02:26 PM UTC

Hi Gunasekaran,

Thanks for the sample code.

After seeing your sample code...I am able to identify the image tag and replace it as well.
But problem is, I have 4 different kind of image tags which need to be replaced by their respective MailMerge Field.

I am not able to differentiate between two WPicture objects.
Please tell me how can I differentiate...Different image tags have different source.

Also is there a way by which I can identify my custom tag...I can use custom tag in place of image tag.

Regards
Naman Ahuja

Gunasekaran T [Syncfusion]
Replied On May 25, 2012 05:38 AM UTC

Hi Naman,

Thank you for your update.

We have prepared the sample to illustrate your requirement to replace image tags having unique source with unique Mail Merge Field and replace text with Merge Field. We cannot differentiate WPicture objects based source path of input html image tag; instead we can replace image tag with text in the input html and replace text with merge field while converting it to Word document using DocIO. Please do find the sample for the same from the attachment. Try running the sample and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Sample_2e3bd8f3.zip

Naman Ahuja
Replied On May 28, 2012 04:35 PM UTC

Hi Gunasekaran,

Instead of replacing text with MergeField object, is there a way by which I can replace the text within the HTML itself... and then convert that HTML directly into doc file. 
So when converting html to doc, it will directly convert the the given html (for merge field)  into merge field in doc .


Gunasekaran T [Syncfusion]
Replied On May 29, 2012 04:27 AM UTC

Hi Naman,

Thank you for your update.

We have prepared the sample to illustrate your requirement to replace text tags with html contents using DocIO. Please do find the sample for the same from the attachment. Try running the sample and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Sample_fb6e2051.zip

Dyana
Replied On December 17, 2012 06:18 AM UTC

Hi Gunasekaran.

I had the same problem but my html code is not in html document. But I collect it in string variable like :

string htmlContent = <p style='text-align: center'>  <strong>please </strong>pick my clothes <u>in my home </u><em>and dont forget the keys. </em><span style='color: #ff0000'>it is my house</span>  </p> <p style='text-align: center'>  <img alt='' src='template/home.jpg' style='width: 272px; height: 209px' /></p>

how about it? I try to use your sample before but it's not work with StreamReader. Thanks :)

Deivaselvan Y [Syncfusion]
Replied On January 2, 2013 04:38 AM UTC

Hi Dyana,

Thank you for your update.

I would like to inform you that this query is a replica of the query mentioned in the forum #106177, Please follow-up with the forum #106177 for a resolution.

Please let us know if you have any other questions.

Regards,
Deiva selvan


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;