We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while doing a MailMerge

I have a license to use aspose 9.1, everything always worked fine, I have an application that does a merge WithRegions, but I started having problems with the error:
Found end of mail merge region ‘DADOS’ without matching start.

                for (int i = 0; i < dst.Rows.Count; i++)
                {

                    num++;
                    table.ImportRow(dst.Rows[i]);

                    if (num > num3)
                    {
                          

                            set.Tables.Add(table);
                            DocumentContainer container = DocumentContainer.Load(str2);

                            try
                            {
                               container.MergeWithRegions(set);
                            }
                            catch (Exception ex)
                            {
                                Uteis.GravaLogTxt("MergeWithRegions erro : ", ex.Message);
                            }


                            container.SalvarPdf(string.Concat(new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" }));
                            ApagaPaginasemBranco(string.Concat(new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" }));
                            Uteis.Status(string.Concat(new object[] { "Gerando arquivo ", str3, "_", itens, ".pdf" }), servico);
                            object[] objArray5 = new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" };
                            list.Add(new Itens(string.Concat(objArray5)));
                     

                            num = 0;
                            itens++;
                            table = new DataTable();
                            table = dst.Clone();
                            table.Clear();
                            set = new DataSet();

                    }
                }

public void MergeWithRegions(DataSet dst)
{
this.Doc.MailMerge.ExecuteWithRegions(dst);
}


This Topic is created by sohail.aspose using the Email to Topic plugin.

@itasouza,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hello Tahir,
I have refactored the whole code, I believe this problem is solved at the moment, I need now to know how to use my aspose license, all the documents are coming out with a description.
I will open a new question for this.

@itasouza,

Thanks for your feedback. It is nice to hear from you that your problem has been solved.

Regarding your license issue, please refer to the following article.
Applying a License