Hello,
I have a problem copying an existing table from my source document in to a newly created document, I get an exception "Cannot insert a node of this type at this location.". Could you please look at the code below and tell me what I'm doing wrong?
Document doc = new Document(@"C:\Quotation.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
// Locate table in source document with a bookmark
if (builder.MoveToBookmark("MyBookMark"))
{
Node TableNode = builder.CurrentNode.GetAncestor(typeof(Aspose.Words.Table));
Aspose.Words.Table Table = ((Aspose.Words.Table)TableNode);
// Do something with Table here...
Document destDoc = new Document();
Node node = destDoc.ImportNode(TableNode, true, ImportFormatMode.KeepSourceFormatting);
destDoc.AppendChild(node); // Exception occurs here!
destDoc.Save("tmp.doc", SaveFormat.FormatDocument, Aspose.Words.SaveType.OpenInBrowser, Response);
}
Regards