# Add document to Diagram via OLE This article explains how to embed a document into a Visio diagram as an OLE object with GroupDocs.Merger for Python via .NET. ## What is an OLE object? OLE stands for "Object Linking and Embedding", a Microsoft technology that lets one document carry content produced by another application. For example, an Excel spreadsheet or a PowerPoint presentation can be embedded into a document edited in a word processor. All the related data then stays in one document, which is easy to share. ## How to add an OLE object to a diagram GroupDocs.Merger for Python via .NET embeds a document into a page of a Visio diagram in three steps: 1. Create an [`OleDiagramOptions`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger.domain.options/olediagramoptions/) with the path to the file to embed and the number of the diagram page to put it on. 2. Create a `Merger` with the path to the diagram, and call `merger.import_document()` with the options. 3. Call `merger.save()` with the path of the result. The following example embeds a PowerPoint presentation into a Visio diagram: {{< tabs "add-document-to-diagram-via-ole" >}} {{< tab "add_document_to_diagram_via_ole.py" >}} ```python from groupdocs.merger import Merger from groupdocs.merger.domain.options import OleDiagramOptions def add_document_to_diagram_via_ole(): # Embed the presentation on page 2 of the diagram, in a 2 x 1 inch shape centred at (1, 1) inch page_number = 2 ole_options = OleDiagramOptions("./embedded.pptx", page_number) ole_options.x = 1 ole_options.y = 1 ole_options.width = 2 ole_options.height = 1 with Merger("./input.vsdx") as merger: merger.import_document(ole_options) merger.save("./output.vsdx") if __name__ == "__main__": add_document_to_diagram_via_ole() ``` {{< /tab >}} {{< tab "input.vsdx" >}} {{< tab-text >}} `input.vsdx` is a sample file used in this example. Click [here](https://docs.groupdocs.com/merger/python-net/_sample_files/developer-guide/import-documents/add-document-to-diagram-via-ole/input.vsdx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "embedded.pptx" >}} {{< tab-text >}} `embedded.pptx` is a sample file used in this example. Click [here](https://docs.groupdocs.com/merger/python-net/_sample_files/developer-guide/import-documents/add-document-to-diagram-via-ole/embedded.pptx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "output.vsdx" >}} ```text Binary file (VSDX, 464 KB) ``` [Download full output](https://docs.groupdocs.com/merger/python-net/_output_files/developer-guide/import-documents/add-document-to-diagram-via-ole/add_document_to_diagram_via_ole/output.vsdx) {{< /tab >}} {{< /tabs >}} ### Explanation - **`OleDiagramOptions("./embedded.pptx", page_number)`**: the file to embed and the diagram page to put it on, counting from 1. - **`x` and `y`**: the position of the shape's pin, its centre of rotation, on the page; `width` and `height` set the shape's size. All four are in inches. ## API reference - [`Merger`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger/merger/) — `import_document`, `save`. - [`OleDiagramOptions`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger.domain.options/olediagramoptions/) — the file to embed, its page, position and size. ## See also - [Import documents]({{< ref "merger/python-net/developer-guide/import-documents/_index.md" >}}) - [Merge files]({{< ref "merger/python-net/developer-guide/merge/_index.md" >}})