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(embeddedFilePath, pageNumber);
oleDiagramOptions.setX(1);
oleDiagramOptions.setY(1);
oleDiagramOptions.setWidth(2);
oleDiagramOptions.setHeight(1);

Merger merger = new Merger(filePath);

merger.importDocument(oleDiagramOptions);
merger.save(filePathOut);

© Aspose Pty Ltd 2001-2022. All Rights Reserved.