Image mail merge not working after upgrade.

We were using version 17.x of DocIO and we could mail merge with images just fine.

We had a business object set up with a LogoImage property being byte[]. In the mail merge document we had a merge field Image:LogoImage. We would do the mail merge:

    document.MailMerge.ExecuteNestedGroup(dataTable);

No additional work was required and we got a Word document with images in it.

We have just updated to 20.2.0.40 and the same code no longer works. I am getting: 

    Value cannot be null. (Parameter 'imageStream')

If I add a MergeImage event like this:

    document.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MergeField_Images);

and debug it I can see that yes the args.ImageStream property is null. But I can also see the args.FieldValue contains a SyncFusion.DocIO.DLS.Entities.Image object with appropriate details filled in. What is going on? I did find this https://www.syncfusion.com/forums/138626/mailmerge-with-image-in-dotnet-core but its from 2018 so not sure if its relevant. I thought maybe I should set ImageStream from inside the MergeImage event as per this example but can't get to my data. I can't typecast FieldValue  to SyncFusion.DocIO.DLS.Entities.Image because  (and even if I could, the ImageData property is not public either. I can't get access to my LogoImage property directly as I don't know what row of the data I am processing and the row data doesn't seem available in either the sender or the args properties passed to the MergeImage event.

What do I do?

Jeff

 



4 Replies

SB Suriya Balamurugan Syncfusion Team August 5, 2022 12:35 PM UTC

Hi Jeff,

We have reproduced the reported problem with “ArgumentNullException while performing mail merge in Word document” in our end, and we suspect it to be a defect. We will validate this issue and update you with more details on 9th August 2022.

Regards,
Suriya Balamurugan.





AN Anto Nihil Sahaya Raj Syncfusion Team August 9, 2022 01:49 PM UTC

Hi Jeff,

We have confirmed that reported issue with ArgumentNullException throws while performing mail merge in Word document" is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release which is estimated to be available on 16th August 2022.

The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/36932/argumentnullexception-throws-while-performing-mail-merge-in-word-document

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,
Anto Nihil S



AN Anto Nihil Sahaya Raj Syncfusion Team August 16, 2022 01:34 PM UTC

Hi Jeff,

As promised earlier, we have included the fix for the reported issue with “ArgumentNullException throws while performing mail merge in Word document” in our latest weekly NuGet release (v20.2.0.44).


Please use the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/20.2.0.44

The status of this bug task can be tracked through the below link:
https://www.syncfusion.com/feedback/36932/argumentnullexception-throws-while-performing-mail-merge-in-word-document

Note: We will include this fix in our 2022 Volume 3 Main release which will be available in end of September 2022.

Regards,
Anto Nihil S



JB Jeff Butterworth August 18, 2022 12:21 AM UTC

I appreciate you taking the time to get this fixed. Unfortunately in this case I had to change my data structures and load them as streams rather than byte[] so I could get a fix out when I first raised the request. But awesome service as usual.


Loader.
Up arrow icon