We copy content all linking Word documents inside source Word document
Aspose.Words.Document sourceDoc = new Aspose.Words.Document(source);
Aspose.Words.NodeCollection shapes = sourceDoc.GetChildNodes(NodeType.Shape,true);
foreach (Shape shape in shapes)
{
if (shape.OleFormat != null)
{
if (shape.OleFormat.IsLink)
{
if (shape.OleFormat.ProgId ==“Word.Document.8”)
{
Aspose.Words.Document LinkedDoc = new Aspose.Words.Document(shape.OleFormat.SourceFullName);
DocumentBuilder builder = new DocumentBuilder(sourceDoc);
builder.MoveTo(shape);
builder.InsertDocument(LinkedDoc, ImportFormatMode.KeepSourceFormatting);
}
}
}
}
Then remove all linking document shapes
…
There was bookmark inside linking document inside footer named ‘BookmartName’ for example.
After our procedure we have two Bookmarks : ‘BookmartName’ and ‘BookmartName_0’
But we need only ‘BookmartName’.