We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge Table in Word Document to another DOCX File using C# .NET | Preserve Bookmarks during Merging

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);
docparent.Save(FileSystemPath + “//EXE-” + hdnExeID.Value + “.docx”);

–After merging parent document bookmark removed
sample document:


To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word documents
  • Aspose.Words for .NET 20.5 generated output DOCX file showing the undesired behavior
  • Your expected DOCX file showing the desired output. You can create this document by using MS Word. Please also list the complete steps that you performed in MS Word to create the expected document on your end
  • Please also create a standalone simple Console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your scenario and provide you code to achieve the same by using Aspose.Words for .NET. Thanks for your cooperation.