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

Free Support Forum - aspose.com

Image Merge using Image Merge Field from URL

Hi,

I just read about the image merge field here: https://docs.aspose.com/words/net/working-with-images/. However, I have a question. I have images coming in from URLs as stream. I have Image merge fields in my template (Image:xxx and Image:yyy). My question is how would I use the method described in the above link to lets say replace xxx by a particular image (www.xxx.com/1.jpg) and yyy (www.yyy.com/jpg) by a different image? What do I need to do to make sure the right images are replaced?

This message was posted using Page2Forum from How-to: Insert Images from a Database - Aspose.Words for .NET and Java

Hi

Thanks for your request. If you have Image:xxx and Image:yyy merge fields in your document and need to insert http://xxx.com/img.jpg into xxx field and http://yyy.com/img.jpg into yyy field, you can just use the following code:

Document doc = new Document(@"Test001\in.doc");
doc.MailMerge.Execute(new string[] { "xxx", "yyy" }, new object[] { "http://xxx.com/img.jpg", "http://yyy.com/img.jpg" });
doc.Save(@"Test001\out.doc");

Hope this helps.

Best regards.