Implement method IFieldMergingCallback.FieldMerging(FieldMergingArgs args)

I have an application that brings a database of two fields, one name(text) and another image(byte[]). How do I run the command doc.MailExcute.ExecuteWithRegions(dsBase), he goes to class HandleMergeImageFieldFromBlob and look for the method IFieldMergingCallback.FieldMerging(FieldMergingArgs args) but could not implement this, how do I do it.
Note: We implemented the method IFieldMergingCallback.ImageFieldMerging(FieldMergingArgs args).
Already thanks for attention.

Hi
Thanks for your inquiry. Your code should look like the following:

[Test]
public void Test001()
{
    // Open your tempalte.
    Document doc = new Document(@"in.doc");
    // Set field merging callback.
    doc.MailMerge.FieldMergingCallback = new MyFieldMergingCallback();
    // Execute simple or mail merge with regions.
    doc.MailMerge.ExecuteWithRegions(myDataSource);
    // Save output.
    doc.Save(@"out.doc");
}
private class MyFieldMergingCallback : IFieldMergingCallback
{
    public void FieldMerging(FieldMergingArgs args)
    {
        // Here is your implementation of FieldMerging method.
        // If you do not need it just leave it empty.
    }
    public void ImageFieldMerging(ImageFieldMergingArgs args)
    {
        // Here is your implementation of ImageFieldMerging method.
        // If you do not need it just leave it empty.
    }
}

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards,

p { margin-bottom: 0.21cm; }
I have a class called MailMergeDataSouce which has a method called GetValue(string fieldName, out object fieldValue) as in the example given by you the link:
https://forum.aspose.com/t/53526
The problem is that when the field is of type string it runs flawless, but on arrival at afield of type byte, and call the method IFieldMergingCallback(ImageFieldMergingArgs args) he says it is not possible to convert an object of typeSystem.String in a of type System.Byte [].
What am I doing wrong?

Hi
Thanks for your request. Could you please create a simple application that will allow me to reproduce the problem? This will help me to understand what is going wrong. I will take a look and try to help you.
Thank you for cooperation.
Best regards,

I found the error, it was only logical.
In the GetValue method, I did a check by the type of variable property if it is of type Byte[].
Thank you for your attention.
I have a new doubt, but I’ll make another post

Hi
It is perfect that you managed to resolve the problem. We will be glad to help you in resolving your other problems, so feel free to ask.
Best regards,