Free Support Forum - aspose.com

MailMerge both XML file and image files


#1

Hello all. I have scoured all over for help on a problem I am having and hope I can get some help on this. I have an Azure storage blob that will contain a docx, XML and image files. I am tasked with creating an Azure function that will pull down the previously mentioned files and merge them using Aspose.Words. I got the XML merging right (see abbreviated code below):

            DataSet ds = new DataSet();
            ds.ReadXml(xmlStream, XmlReadMode.InferSchema);
            Document doc = new Document(templateStream);
            doc.MailMerge.ExecuteWithRegions(ds);

Now comes the images. I have tried a second MailMerge by doing something like the following:

	string[] names = {"SomeImage" };
	string[] values = { @"https://xxxxxxx.blob.core.windows.net/SomeContainer/SomeImage.jpeg" };
	doc.MailMerge.Execute(names, values);	

The MailMergeTag within the docx for the image is <Image:SomeImage>. This overall process I am doing is probably not the correct/best way to do this and would greatly appreciate any other suggestions or help.


#2

@schappa,

Please ZIP and upload your sample input Word document and XML file here for testing. We will then investigate the scenario on our end and provide you more information.