MailMerge with custom object in table and html results in wrong position

@Alex1974

Please use the following code example to achieve your requirement. Hope this helps you.

Aspose.Words.Document doc = new Aspose.Words.Document(MyDir + "MainTestOhf4_out_without_removal.doc");
while (string.IsNullOrEmpty(doc.LastSection.Body.LastParagraph.ToString(SaveFormat.Text).Trim()))
{
    int childnodes = doc.LastSection.Body.LastParagraph.ChildNodes.Cast<Node>().Where(child => child.NodeType != NodeType.Run).ToList<Node>().Count;
    if (childnodes > 0)
        break;
    else
    {
        doc.LastSection.Body.LastParagraph.Remove();
        if (doc.LastSection.Body.LastParagraph.PreviousSibling != null &&
            doc.LastSection.Body.LastParagraph.PreviousSibling.NodeType == NodeType.Table)
        {
            break;
        }
    }
}
doc.Save(MyDir + "19.2.doc");