Exception TableStart and TableEnd should be in the same section using .NET

Hi there,

I’m trying to work with the TableStart / TableEnd tags with MergeField. I’m trying to create a simple table with only 1 field. When I use this

«TableStart:TableA»
«FieldA»
«TableEnd:TableA»

in a normal new Word Document, it works fine. When I try to use it again on a document that was converted from a PDF I get the error mentioned above.

I’ve read both links below and neither have helped move this problem forward:

https://forum.aspose.com/t/55833
https://docs.aspose.com/words/net/types-of-mail-merge-operations/
I’ve tried putting it alongside the other words in the document, in a separate text box as well as in another table, neither have worked. That being said, the regular Mergefields I have in the document work fine.
Thanks for your help in advance :slight_smile:

Hi Qamar,

Thanks for your inquiry. Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v15.2.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v15.2.0 and let us know how it goes on your side. I hope, this will help. I have attached the output Pdf with this post for your kind reference.

Document doc = new Document(MyDir + "WCB+NB+Employer44.    docx");
DataTable dt = new DataTable("Witnesses");
dt.Columns.Add("WitnessName");
DataRow dr = dt.NewRow();
dr["WitnessName"] = "Value 1";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["WitnessName"] = "Value 2";
dt.Rows.Add(dr);
doc.MailMerge.ExecuteWithRegions(dt);
doc.Save(MyDir + "Out.pdf");