- Home
- Forum
- Console App
- MailMerge with both Execute and ExecuteGroup does not work
MailMerge with both Execute and ExecuteGroup does not work
Hello, I have document with some MailMerge fields, and one MailMerge Table. The code opens the document, retrieves the data for the fields, then does the below, this does NOT work.
document.MailMerge.ExecuteGroup(dataTable);document.MailMerge.Execute(fieldNames, fieldValues);Thank you for contacting Syncfusion support.
We have tried to perform mail merge using ExecuteGroup and Execute but it is working fine at our end.
For your reference we have attached the sample application at our end.Please refer the sample from the below link:
We suspect that the reported problem might be due to the file level information in the input Word document which used at your end. So, to analyze further on the reported problem, could you please provide us the following things from your end:
1. Input Word document.
This will be more helpful to check and share the details at the earliest.
Please let us know if you have any other questions.
Regards,
Lokesh B
I'm having the same problem.
I took your example and upgraded to the latest version of the nuget packages so version
20.2.0.44
I also used the GetDataTable() method as the data source for the ExecuteGroup so it has different data in the table.
In the example you provide you created 3 rows of sample data.
so if you do this, you will see it does not work
Attachment: ConsoleSample_24bc5230.zip
Hi Cloud
admin,
We have reproduced the reported issue “Group merge fields are not executed properly while executing
mail merge using both Execute() and ExecuteGroup() methods” in our end,
and we suspect it to be a defect. We will validate this issue and update you
with more details on 24th August 2022.
Regards,
Anto Nihil S
Hi Cloud admin,
On further validating the reported issue, we found
that the merge field inside the group and outer are in same name. So while
executing merge field (wordDocument.MailMerge.Execute(fieldNames, fieldValues)),
the field inside group also execute. This is the behavior of Microsoft Word
too. So that reported issue occurs.
As a workaround, we suggest you
following ways to resolve that reported
issue at your end.
1.Execute group merge field first (wordDocument.MailMerge.ExecuteGroup(GetDataTable())).
Because while executing the group merge field, it execute only field inside the
group merge field. So it will not affect the individual merge field. So now
execute the individual merge field provide valid result. Please find the
modified sample below attachment.
(or)
2. Set different names
for merge field inside group and outer in template Word document.
Please let us know if you need any further assistance in this.
Regards,
Anto Nihil S
Attachment: ConsoleSample_a6c2f53b.zip
- 4 Replies
- 4 Participants
-
CA Cloud admin
- Jun 21, 2021 05:17 PM UTC
- Aug 24, 2022 04:41 PM UTC