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. Image for the cookie policy date

replace a string with an image

Hi,how can i replace in a document all the string [LOGO] with an image/picture ?

Thanks
Piermaria

7 Replies

PS Piermaria Saglietto August 26, 2006 08:49 AM UTC

... or pheraph a better question is:
can i create a Merge Field with DOC IO ?
Thanks
Piermaria


AD Administrator Syncfusion Team August 28, 2006 04:34 PM UTC

Hi Piermaria,

Sorry for delay in getting back to you.

Currently, it is not possible to search a particular place holder text from template document and replace it by image/picture. I have added this as a feature request with our development team. You can track the live status of this feature here,

Feature Request #1028 - Finding a particular place holder and replace it with document elements

Sorry for the inconvenience.

Best regards,
Prabhu.


>Hi,how can i replace in a document all the string [LOGO] with an image/picture ?

Thanks
Piermaria


AD Administrator Syncfusion Team August 28, 2006 04:54 PM UTC

Hi Piermaria,

Yes, it is possible to create a Merge Fields with DocIO. I have created a small sample to illustrate this feature. I have attached the sample. Could you please refer the sample and let me know if you need any other assist.

Best regards,
Prabhu.


>... or pheraph a better question is:
can i create a Merge Field with DOC IO ?
Thanks
Piermaria

Inserting_MergeFields.zip


PS Piermaria Saglietto August 30, 2006 09:18 AM UTC

Hi Prabhu,
your example is ok.
But now can i replace all strings [LOGO] in a document with a MailMergeFiled called <> ?

Thanks in advance

Piermaria


AD Administrator Syncfusion Team August 30, 2006 11:17 PM UTC

Hi Piermaria,

Currently, it is not possible to replace a placeholder by Merge fields [ Paragraph items ]. However, our developers are working with this feature. I will update you once the feature gets implemented.

Sorry for the inconvenience.

Kind regards,
Prabhu


ER Eric Rosenblum July 17, 2018 10:01 PM UTC

can you replace the source of an existing image with a different image? like replace logo1.png with logo2.png?


MJ Mohanaselvam Jothi Syncfusion Team July 18, 2018 11:37 AM UTC

Hi Eric,

Thank you for your update.

We suggest you to use
LoadImage API of DocIO to replace existing image in the Word document. To identify the existing image in the Word document, we suggest you to set title for the image in the Word document using Microsoft Word application and then replace with new image using DocIO based on that title.
Please refer the below screenshot to set title for image in the Word document:
Right click on image -> Format Picture.
 
 
 
 

For your reference, we have prepared a sample application to get the pictures in Word document and replace the image based on the title of picture.

Please find the sample from the below link and let us know if this helps you:
http://www.syncfusion.com/downloads/support/forum/48410/ze/GenerateWord-1845742562.zip

In this sample we have done the following things:
  1. Loads existing Word document using DocIO.
  2.  Iterates into document elements and get the pictures.
  3. Replaces image based on the
Title property of WPicture.
  4. Saves the Word document.

Please let us know if you have any other questions.


Regards,
Mohanaselvam J
 


Loader.
Live Chat Icon For mobile
Up arrow icon