Possible bug with MailMerge.ExecuteWithRegions and MailMerge.Execute in combination

I’m using Aspose.Words 10.5.0.0. I have a Word Document template that contains both tables and single merge fields.

If I call MailMerge.Execute first and then MailMerge.ExecuteWithRegions, then the tables are not populated in the resulting document, but the single fields are correct.

If I switch the order so that MailMerge.ExecuteWithRegions is called first, then all fields are filled in correctly.

Is this a known issue?

Hi Ben,

Thanks for your inquiry.

I have tested the scenario and have not found the shared issue while using latest version of Aspose.Words for .NET 14.1.0. Please use the latest version of Aspose.Words for .NET 14.1.0. I have attached the input/output document with this post for your kind reference.

If you still face problem, please share following detail for investigation purposes.

  • Please attach your input template document.
  • Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to generate your output document
var dt = new DataTable("Orders");
dt.Columns.Add("Test2");
dt.Rows.Add("Mail Merge ExecuteWithRegions");
var doc = new Document(MyDir + "in.docx");
doc.MailMerge.Execute(new string[]
    {
        "Test"
    },
    new object[]
    {
        "Mail Merge Execute"
    });
doc.MailMerge.ExecuteWithRegions(dt);
doc.Save(MyDir + "Out.docx");