With Object Linking and Embedding (OLE) you can embed the output window from one Windows application into another Windows application. Use this, for example, to enhance a Microsoft Word document with Creo Elements/Direct Drafting drawings. Or add Microsoft Excel data to your Drafting drawing.
Follow these two examples to learn how to use OLE with your data:
Note. The examples below assume you have standard installations of Microsoft Word and Excel and Creo Elements/Direct Drafting. The file types ‘MI’ and ‘DOC/DOCX’ and ‘XLS/XLSX’ need to be registered on Windows.
Example 1: A Microsoft Word document enhanced with a Creo Elements/Direct Drafting OLE
Suppose you’re creating a product manual. You can use your Creo Elements/Direct drawing to illustrate your Word document. In this example, you’ll see how a section of a Creo Elements/Direct Drafting .mi file is embedded in Word.
- Start Microsoft Word
- Load the Word document
- Click ‘Insert’ → 'Object’ (Fig. 1)
- The dialog to embed an object appears. Activate the ‘Create from File’ tab (Fig. 2)
- ‘Browse’ to the Drafting drawing (the file must have a .mi file extension) and load it
Note. The MI OLE object is now linked to the Word document, but the view is NOT updated. At this point, you should see a black rectangle (Fig. 3).
- Click on the black rectangle. Drafting will start and load the drawing that you linked to the Word OLE (Fig. 4)
The Drafting OLE will be inserted into Word with Drafting’s background color, line size, line color, and view. In the next few steps, you’ll modify Drafting settings to create just the view you want in the Word window. You can change the background color by inserting a macro command into Drafting’s command line (Fig. 5).
- Type: CHANGE_VIEWPORT_COLOR WHITE
- Change the geometry color to black with: ‘Geometry’ → ‘Change’ → ‘COLOR….’ → ‘Black’. Mark all geometry (Fig. 6)
- Specify which part of the drawing appears embedded in the Word document from Creo Elements/Direct Drafting. In this example, only the geometry within the red rectangle (Fig. 7) should fill the viewport
- To isolate it, use:
- Zoom: ctrl + right Mouse button
- Move: ctrl + left mouse button
- Check the view in Drafting’s viewport. The geometry shown in Drafting’s viewport is the same as that which will appear in Word (Fig. 8)
- Now you’re ready to update the drawing in Word. Close Drafting by clicking on the red cross. Answer the ‘Update’ question with ‘Yes’ (Fig. 9)
- In Word, you can now adjust the size of the Drafting OLE in your document. The blue rectangles (Fig. 10) show the frame of the Drafting OLE
- Move and zoom the Drafting OLE into the text (Fig. 11). Word can create different frames for embedded OLEs. In this example a broad black line was selected
Example 2: A Creo Elements/Direct Drafting drawing enhanced with a Microsoft Excel table
Suppose you’d like to include a workflow to a design. In this example, we embed data from an Excel file in a Creo Elements/Direct Drafting drawing.
Generally, Excel spread sheets have black text on a white background (Fig. 1). Drafting has white text and geometry on a black background.
- Change in Excel text and frame color to white and the background color to black (Fig. 2) and store
- Store the Excel sheet that is prepared for Creo Elements/Direct Drafting 17.0
- Start Creo Elements/Direct Drafting 17.0
- Load a drawing
- From Creo Elements/Direct Drafting, click ‘Insert’ → ’Object’. The Insert Object dialog appears (Fig. 3)
- In the ‘Inset Object’ menu, check ‘Create from File’
- Browse to the Excel sheet
- Click ‘OK’
- Enter a Creo Elements/Direct Drafting internal name for the OLE, or accept the given OLE name (Fig. 4). In this case, we used the name, Excel.Sheet.12. The OLE will be listed with that name in Drafting’s OLE list
- Now resize and move the OLE until it suits your drawing (Figs. 5 and 6). The OLE can be resized and moved as any Drafting object
OLE Enhancements in Creo Elements/Direct Drafting 17.0
OLE handling was introduced with Creo Elements/Direct Drafting 9. But Creo Elements/Direct Drafting 17 added outstanding enhancements in OLE handling for usability, printing, and inquiries. Now:
- OLEs are attached to Drafting parts. OLEs can be handled inside the part structure
- Drafting OLEs are compatible with Annotation
- The following general commands can be applied to OLE; no separate commands needed anymore:
- Undo/Redo support enabled
- Modify with all its options
- Change Level
- Print to PDF and PS files enabled
- Possible to inquire OLE objects (see next slide for inquire numbers)
- The following inquire commands have been added for OLE elements:
- INQ 28 (returns Z-level for PICTURE and OLE)
- INQ 318 (returns application name)
- INQ 319 (returns class ID)
- INQ 320 (returns OLE type as „LINK“, „EMBEDDED“ or „STATIC“)
- The following inquire numbers for OLE elements have been revised:
- INQ 403 (returns OLE, if OLE is selected and not PICTURE as before)
- INQ 8 (returns 3 if OLE is shown in icon mode)