Free Support Forum - aspose.com

"start and end node should have the same grand parent" exception on MailMerge.Execute

Hi,

I'm having an exception with the attached Word template.

The problem occurs with this code:

document.AsposeDocument.MailMerge.Execute(ds.Tables[0])

Exception message : "start and end node should have the same grand parent".

I don't have any trouble with my other templates.

Would you look at this template and let me know if there's anything I can do?

Thanks !

Edit : Stack trace if it could help you :
à Aspose.Words.CompositeNode.ວ(Node Ԛ, Node ມ, Node ॶ, CompositeNode ຢ)
à Aspose.Words.CompositeNode.ຠ(Node Ԛ, CompositeNode ມ, Node ॶ, CompositeNode ຢ)
à Aspose.Words.Field.ๆ()
à ࣢.ᙏ.ไ(FieldStart Ԛ, FieldSeparator ๅ, FieldEnd ॶ)
à ࣢.ᙂ.ᙃ(FieldStart Ԛ, FieldSeparator ๅ, FieldEnd ॶ)
à ࣢.ᙳ.VisitFieldEnd(FieldEnd fieldEnd)
à Aspose.Words.FieldEnd.Accept(DocumentVisitor visitor)
à Aspose.Words.CompositeNode.ສ(DocumentVisitor ஓ)
à Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
à Aspose.Words.CompositeNode.ສ(DocumentVisitor ஓ)
à Aspose.Words.Body.Accept(DocumentVisitor visitor)
à Aspose.Words.CompositeNode.ສ(DocumentVisitor ஓ)
à Aspose.Words.Section.Accept(DocumentVisitor visitor)
à ࣢.ᙳ.ᙷ(Node ۹)
à ࣢.ᙳ.ᙸ(ArrayList ᙹ)
à ᠳ.ᠺ.ᡅ(ArrayList ᡆ)
à ᠳ.ᠺ.ᡄ()
à ᠳ.ᠺ.Ջ(MailMerge ᡁ, ᠸ ᠦ)
à Aspose.Words.Reporting.MailMerge.ᠥ(ᠸ ᠦ)
à Aspose.Words.Reporting.MailMerge.Execute(DataTable table)

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The problem occurs because there is section break inside field code. Just remove this break and no errors will occur. (Press Alt+F9 to see field code, on the second page after “Article5” you will see section break).

Also note that Aspose.Words does not evaluate IF field. See FAQ for more information:

Best regards.

Thanks for your help !