Add document to Diagram via OLE

What is OLE object for Diagram?

The OLE technology provided by Microsoft allows to insert some other document content into the shape with size and coordinates which are previosly selected by X, Y, Width and Height of the currently editing Diagram page. For example, the Slides document can be inserted in the Diagram document inside of shape as was presented in the example below.

Add document to Diagram via OLE

GroupDocs.Merger provides an ability to add other single document as embedded document to Presentation. 
Here are the steps for it:

The following code sample demonstrates how to add other single document as embedded document to Diagram page:

string filePath = @"c:\sample.vsdx";
string filePathEmbedded = @"c:\embedded.pptx";
string filePathOut = @"c:\output\result.vsdx";

int pageNumber = 2;
OleDiagramOptions oleDiagramOptions = new OleDiagramOptions(filePathEmbedded, pageNumber);
oleDiagramOptions.X = 1;
oleDiagramOptions.Y = 1;
oleDiagramOptions.Width = 2;
oleDiagramOptions.Height = 1;

using (Merger merger = new Merger(filePath))
{
    merger.ImportDocument(oleDiagramOptions);
    merger.Save(filePathOut);
}

More resources

Advanced Usage Topics 

To learn more about document merging features, please refer the advanced usage section.

GitHub Examples 

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to merge your documents with our free online GroupDocs Merger App.