MailMerge not working?

Good afternoon! 

Having some trouble with the following. 
I have a word document for a table that I need to duplicate based on how many items are in a payload. 

I open up the document and put it into a WordDocument variable (currentDoc) for use. For simplicitys sake - I have the following code: 

JObject formattedResponse = new JObject();
formattedResponse["payload"] = formattedPayload;
currentDoc.MailMerge.ExecuteGroup(GetDataTable(formattedResponse.ToString()));



formattedPayload looks like the following:

{{
  "payload": [
    {
      "%%IFSJTempLimit": "11",
      "%%IFSJSingleLimit": "9",
      "%%IFSJTransitLimit": "12",
      "%%IFSJDed2": "",
      "%%IFSJDed3": "",
      "%%IFSJDed6": "",
      "%%IFSJEarthLimit": "13",
      "%%IFSJEarthDed": "14",
      "%%IFSJFloodLimit": "15",
      "%%IFSJFloodDed": "16",
      "IFSJName": "1236 See Lane FL, FL 32548 "
    }
  ]
}}

Now, if I use the full word document (Sample - Good.docx) this works fine. However, if I delete everything but the table (Sample - Bad.docx), the mailmerge does not work. I have included the json as a file that simulates the payload. 

Is there something here I might be missing you could assist me with? 


Attachment: MailMerge_Syncfusion_Question_b0fa0f7f.zip


1 Reply

DS Dharanya Sakthivel Syncfusion Team April 8, 2025 01:28 PM UTC

Hi Sydney,

Based on the details provided, we understand you're facing an issue with mail merge. We performed group mail merge using the input document and JSON file you shared, and it works correctly on our end for both the "good" and "bad" documents.

Kindly refer to the attached sample and result documents. In the sample, we used the GetDataTable() method to convert the JSON into a DataTable.

Also, ensure the table name in the template matches the JSON exactly — the template uses TableStart:Payload, but your JSON uses "payload" (lowercase), which must match for the mail merge to work.

Kindly refer to the article. How to Execute Nested Group Mail Merge with JSON in ASP.NET Core Word?

Regards,
Dharanya.


Attachment: Generatetableusingmailmege_a26241c4.zip

Loader.
Up arrow icon