Hi Team,
Merging a table one word document to another word document, after merged bookmark remove that document using aspose.word
We are using sample coding:
Aspose.Words.Document docparent = new Aspose.Words.Document(FileSystemPath + “//EXE-” + hdnExeID.Value + “.docx”);
Aspose.Words.Document docExecuted = new Aspose.Words.Document(FileSystemPath + “//EXE-” + hdnExeID.Value + “-Temp.docx”);
int isection = 0;
foreach (Aspose.Words.Section section in docparent.Sections.OfType<Aspose.Words.Section>())
{
var tablecount = section.Body.Tables.Count();
for (var i = 0; i < tablecount; i++)
{
Aspose.Words.Tables.Table tableA = section.Body.Tables[i];
Aspose.Words.Tables.Table tableB = docExecuted.Sections[isection].Body.Tables[i];
if (tableA != null && tableB != null)
{
Aspose.Words.Tables.Table newTable = (Aspose.Words.Tables.Table)docparent.ImportNode(tableB, true);
tableA.Remove();
}
}
isection++;
}
docparent.Save(FileSystemPath + “//EXE-” + hdnExeID.Value + “.docx”);
–After merging parent document bookmark removed
sample document: