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

Free Support Forum - aspose.com

How to get Mail Merge Image fields in .dot document

how to get mail merge image fields from .dot document
in .dot document i getting all mail merge fields except image mail merge fields.but in .dotx document i am getting all mail merge fields.

Hi there,

Thanks for your inquiry. Could you please attach your input ODT document here for testing? I will investigate the issue on my side and provide you more information.

i don’t have access to get documents in my office,
is it possible to get mail merge image fields from .dot documents?

Hi there,

Thanks for your inquiry. Yes, you can get mail merge fields from DOT file formats using MailMerge.GetFieldNames method. You can load the document mentioned at following documentation link into Aspose.Words DOM.

Moreover, please read about mail merge using Aspose.Words from here:

hi ,
its not working
for getting mailmerge fields i did like this

LoadOptions loadOption=new LoadOptions();
Document doc=new document("filename",loadOption);

in the document the image Mergefiled is like this
[INCLUDE PICTURE{MergeField Name}]
but for .dotx document is getting the image merge filed name

Hi there,

Thanks for your inquiry. Please use set the value of LoadOptions.PreserveIncludePictureField as true as shown in following code example. I have attached a sample input document with this post for your kind reference.

By default, the INCLUDEPICTURE field is converted into a shape object. You can override that if you need the field to be preserved, for example, if you wish to update it programmatically. Note however that this approach is not common for Aspose.Words. Use it on your own risk.

One of the possible use cases may be using a MERGEFIELD as a child field to dynamically change the source path of the picture. In this case you need the INCLUDEPICTURE to be preserved in the model.

LoadOptions options = new LoadOptions();
options.PreserveIncludePictureField = true;
options.LoadFormat = LoadFormat.Odt;
Document doc = new Document(MyDir + "in.dot", options);
foreach (string name in doc.MailMerge.GetFieldNames())

Hi Tahir,
Thanks,it is working

Hi there,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.