Thanks for your inquiry.
1. Yes, you can move cursor to a specified merge field and insert image there. Please see the following overloads of DocumentBuilder.MoveToMergeField methods:
DocumentBuilder.MoveToMergeField Method (String)
DocumentBuilder.MoveToMergeField Method (String, Boolean, Boolean)
Here is sample code to achieve this:
Document doc = new Document(getMyDir() + “in.docx”);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage(getMyDir() + “aspose.words.png”);
doc.save(getMyDir() + “out.docx”);
2 & 3. If you want to control how data is inserted into merge fields during a mail merge operation, you need to implement IFieldMergingCallback Interface
. This interface has a IFieldMergingCallback.ImageFieldMerging event which occurs during mail merge when an image mail merge field
is encountered in the document. You can respond to this event to return a file name, stream, or an Image object to the mail merge engine so it is inserted into the document. The following article will be helpful as well:
However, if you just want to move the cursor to a merge field and then insert image at this place using DocumentBuilder, then there is no need to prefix merge fields with “Image:” marker.