Microsoft KB Archive/91623

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for Windows versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c
 * Microsoft Windows operating system version 3.0 and 3.1

SUMMARY
This article contains general information on linking and embedding objects in Microsoft Word for Windows documents.

Client and Server Applications
A client is an application whose documents can accept linked or embedded objects. A server is an application that creates objects that can be linked and embedded into other documents.

When you double-click (activate) an embedded object in a client document, the server application for the object is invoked, unless it is already running, and a new document window is opened for editing the object. When you double-click a linked object, the server application for the object is invoked, unless it is already running, and the source document is opened in a new window. If you activate an object and the server application is already running but does not support multiple document windows, a new instance of the server application is invoked.

Embedded or Linked Objects
A compound document is one that contains one or more linked or embedded objects. An object is any data that can be displayed in a compound document and can be manipulated by the user. Once inserted, an object maintains an association with the application that created it. Objects are data with &quot;behavior.&quot; For example, a graphical image is simply data; however, if the graphical image can be activated (that is, given behavior) to allow editing in another application (a server), it is considered an object.

There are two types of objects: linked objects and embedded objects. These types behave differently. The data of an embedded object is completely contained within the client document. Embedded objects consist of three components: an OwnerLink (data that identifies the object by its server name), a Presentation (data used to display and print the object), and Native Data (data that defines the object in the format that the server application understands).

A linked object contains a reference (or link) to data shared by a server application and a client. A linked object consists of two components: an ObjectLink (data that identifies the object by its server name and specifies the native data source) and a Presentation (data used to display and print the object). Native Data, which defines a linked object, is stored in a source file to which the object is linked.

An embedded object increases the client file size more than a linked object because the embedded object contains its native data.

Note: Do not confuse linking an object with linking to a file, as with the Insert Picture command. In the Picture dialog box, if you select the Link To File check box, Word inserts an IMPORT field in the document. The IMPORT field reads the graphics-format file and displays a bitmap as its result. If you double-click a picture (or any static graphic) inserted by the IMPORT field, Word makes the picture a Microsoft Draw embedded object and opens Draw so that you can edit it. Any link to an original source file is lost.

Actions you can perform on an object are called verbs. The verbs an object uses depends on the nature of the object. For example, a sound object has a primary verb &quot;play&quot; and a secondary verb &quot;edit.&quot; When you double-click the object, the primary verb action is activated. Play and edit are two common object verbs. Many objects support one verb only.

Inserting Objects
To insert an embedded object in a Word document, choose Object from the Insert menu and select the type of object desired. This launches an instance of the selected server application if necessary and opens a new document window in the server. The document title bar reads &quot;Object in &quot; indicating that you are editing an object. You may also launch the server application independently of Word, select the desired data and copy it to the Clipboard, then choose Paste from the Edit menu in Word.

Note: Generally, the Edit Paste command embeds the object that is on the Clipboard. Under some circumstances, however, (for example, with a Microsoft Excel worksheet), Word may not embed the object but merely insert a static copy of the data.

When you embed an object, Word creates an EMBED field. The switch \s enables you to scale the embedded object to the size you want by dragging the sizing handles.

To insert a linked object into a Word document, launch the server application independently, open a source document, select the desired data, copy it to the Clipboard, and then choose Paste Special from the Edit menu in Word. Select the desired data format and choose Paste Link. If Paste Special is unavailable, the source application is probably not an OLE server.

In a LINK field, you can automatically insert any of the following switches, depending on which format you select in the Paste Special dialog box:

Switch    Result ---   -

\a        The link updates automatically. \t        Inserts the linked object as unformatted text. \r        Inserts the linked object as RTF text. \p        Inserts the linked object as a picture. \b        Inserts the linked object as a bitmap.

Editing Objects
If the object is displayed as a graphic image, the easiest way to edit it is to double-click the image. This opens the object in the server application and allow manipulation of the data. Double-clicking activates (or runs) the primary verb for the object. You can also select (single- click ) the object and choose &quot; object&quot; from the Edit menu. If your linked object is displayed as text or is an object whose primary verb is not edit, or if you have the EMBED or LINK field codes are displayed, select the object or field code and then choose &quot; object&quot; from the Edit menu.

If you need to modify or repair the nature of a link, choose Links from the Edit menu. All current links are displayed in and are modified from this dialog box.

In general, if you paste a linked object as RTF text, it first displays with the same formatting as in the source application. If you change the text formatting of the object in Word and then reformat the source, the Word formatting prevails because of the &quot;\* mergeformat&quot; switch in the LINK field. The actual data in the object changes to reflect the source.

In general, if you paste a linked object as unformatted text, it first appears formatted with your Word default font. If you change the formatting of the object in Word and then reformat the source, the Word formatting prevails because of the &quot;\* mergeformat&quot; switch in the LINK field. The actual data in the object changes to reflect the source.

In general, if you paste a linked object as a picture or bitmap, it appears exactly as it does in the source document. Changes to the formatting of the source document display in Word. The format of this object cannot be modified in Word, but the object can be sized and scaled by dragging the object's sizing handles.

Reference(s):

&quot;Microsoft Windows, Object Linking and Embedding (OLE)&quot; application note
 * }

-

Last reviewed: July 30, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.