Mail Merge Field question

Mail merge fields like Image:MyFieldName, TableStart:MyTable, TableEnd:MyTable
Are these fields and syntax specific to aspose or these are from microsoft word? Becuase when i try to create template using MS word and add Merge Field, i dont get
Image or table option.

Hi there,

Thanks for your inquiry.

This types of merge fields contain special Aspose.Words syntax which does not exist in Microsoft Word. Therefore there are no options for them found inside MS Word. Instead you write the prefix e.g “Image:MyField” along with the field name.

For a demonstration of how to do this, you can check out the video here.

Thanks,

Thank You that video really helped
The example here https://docs.aspose.com/words/net/working-with-images/ says in order to handle Image Field we need to implement class from IFieldMergingCallback and then set Document.MailMerge.FieldMergingCallback.
Why in the example above they are setting stream if the field value is already byte[]?
For me its working without implementing the IFieldMergingCallback class. How? Here is my code

public void Word_MailMerge_And_Add_Signature_From_DB()
{
    Aspose.Words.Document document = null;
    using (Stream wordSourceStream = new MemoryStream())
    {
        DBOperations dbOperations = new DBOperations();
        dbOperations.FetchFile_Using_SqlFileStream(wordSourceStream, "Cover Letter with mail merge fields.docx");
        wordSourceStream.Seek(0L, SeekOrigin.Begin);
        document = new Aspose.Words.Document(wordSourceStream);
    }
 
    //Perform Mail Merge
    document.MailMerge.Execute(ContextData.GetDataTable());
    document.Save("output.docx");
}

internal class ContextData
{
    public static DataTable GetDataTable()
    {
        DataTable table = new DataTable();
        table.Columns.Add("YourName");
        table.Columns.Add("YourAddress");
        table.Columns.Add("YourCityStateZip");
        table.Columns.Add("ClientName");
        table.Columns.Add("Signature",typeof(Array));
 
        DataRow row = table.NewRow();
        row["YourName"] = "Jhon Dow";
        row["YourAddress"] = "4500 Test Avn";
        row["YourCityStateZip"] = "Austin, TX 75365";
        row["ClientName"] = "Some Client";
        row["Signature"] = GetImage();
        table.Rows.Add(row);
        return table;
    }
 
    private static byte[] GetImage()
    {
        DBOperations dbOperations = new DBOperations();
        MemoryStream imageStream = new MemoryStream();
        dbOperations.FetchFile_Using_SqlFileStream(imageStream, "signature_sample.gif");
        imageStream.Seek(0L, SeekOrigin.Begin);
        return imageStream.ToArray();
    }
}

Hi
Thanks for your request. In the article we just show a way how you can load images from any source you like. The code provided there just demonstrates the technique. If you datasource already contains data of images as byte array you do not need the IFieldmergingCallback.
Best regards,