We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

The value of an image field is replaced by the value of the parent if it is null during mailmerge

Hello

I have a class DataModel with a name, an image and a property Children containing a list of DataModel.
In my template Word, I want to display the image of each child. I am using a mailmerge (ExecuteNestedGroup) to do that.

If the property Image of the child returns a value, the image is well displayed. But, if the child does not have an image and the property Image returns null (if it is a System.Drawing.Image) or "" (if it is a string), the field is filled with the Image of the parent.

I don't want this behaviour. If my child does not have any image, I will just display nothing. What can I do to avoid that ?

I have created a solution to help you understand the problem.

Thanks

Attachment: ChildFieldWithParentValue_8b4e8c18.zip

3 Replies

VR Vijay Ramachandran Syncfusion Team November 17, 2016 03:48 PM UTC

Hi Delphine,

Thank you for contacting Syncfusion support.

As per the behavior of the ExecuteNestedGroup() method, if the inner table field value is null and at the same time outer table have same field name with proper value then DocIO uses the outer table data. If it multiple nested table means this process continou untill the root table reached or untill reach the value for the field.

If your requiremnet is using inner table value only means you could specify particular table name as prefix of the Merge field in your template document as like below:

 
Children:assemblyName 
Image:Children:assemblyImage 
We have also modified the given input template document, please find the modified template document from below link:
http://www.syncfusion.com/downloads/support/forum/127452/ze/ModifiedTemplate1950556623.zip

If we misunderstood any of your requirement then kindly elaborate the actual requirement with detailed description.   Thereby we will analyze further on the mentioned case and will provided you appropriate solution.

Let us know if you have any concern.

Regards,
Vijay R



DL Delphine Lacour November 21, 2016 08:54 AM UTC

Hi Vijay,

Thanks for the help. I used "Image:Children:assemblyImage" and it works perfectly.

Regards


SY Sethumanikkam Yogendran Syncfusion Team November 21, 2016 09:23 AM UTC

Hi Delphine,

Thank you for your update.

Please let us know if you need any further assistance on this. We will be happy to assist you as always.

Thanks,
Sethumanikkam.Y


Loader.
Live Chat Icon For mobile
Up arrow icon