Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lectures_SSD2_Yermakova / Lectures_SSD2 Yermakova.doc
Скачиваний:
226
Добавлен:
25.02.2016
Размер:
3.16 Mб
Скачать

4.2.3 Lab: Embedding Application Objects

Object Linking and Embedding (OLE) is a facility provided by more sophisticated applications, and it requires operating system support. The OLE facility allows data (typically graphics or spreadsheets) that has been created by any of a number of different applications to be combined into a single document file.

The imported data is treated as a single object that can be moved or deleted from the document or even edited by using the original application that created the data. The act of embedding data within a document is much more powerful than the simple copy-and-paste operations that you are probably already familiar with. The copy-and-paste approach typically inserts the data in a format compatible with the application that the data is pasted into. But, some types of information may be lost in this process (spreadsheet formulas, for example), and the data imported in the manner cannot be updated later by the application that created it.

Embedding, however, is not supported by all applications. And, it has one other drawback: the application used to create the data must be installed on your computer if you wish to edit the data. For example, if somebody gives you a Word document with an embedded Excel spreadsheet, your computer must have Excel installed on it in order for you to edit the embedded spreadsheet. Embedding and a similar operation called linking are often found in integrated suites of applications, such as those provided by Microsoft Office or Coral's office applications.

Linking differs from embedding in that the linked object is just a pointer to the document containing the data to be imported, rather than the data itself. With anembedded object, any changes to the imported data are saved as part of the host document; they do not affect the original document that was the source of the data. But, with a linked object, a change to the original data will affect all documents that are linked to that data. People who are viewing a file containing a linked object can see the changes made by someone else.

Learning Exercise:

If you have access to Microsoft's Word and Paint applications, you can create a bitmapped graphic using Paint, embed it as an object in a Word document, and modify the graphic while viewing the document in the Word application.

  • Start Microsoft Word. Edit an existing document or create a new one by typing a few lines of text.

  • Start Microsoft Paint. (On the taskbar, click the Start button, and then click Programs, then Accessories, and then Paint.) Now, draw something. You might try choosing a color from the color palette at the bottom of the window, then selecting the spray-can tool and using it to write your name.

  • Click the border tool (the icon that is a broken & endash; border rectangle) and click-and-drag to draw a border around your creation. Then, on Paint's Edit menu, click Copy. Now your selection has been copied to the Clipboard. Close Paint.

  • Go back to Word. Within your Word document, click where you want the embedded graphic to appear. On Word's Edit menu, click Paste Special.... Notice that the Paste Special dialog box provides you with some alternative formats for the data being inserted. Ignore these formats, and do not select the Display as Icon check box. Just click OK to accept the Bitmap Image Object setting (which is the default). Now, notice the impact these actions have on your document.

  • Double-click the graphic object now embedded in your Word document, and a version of Paint should be started, allowing you to edit the embedded graphic. Make some minor changes in your graphic (say, by clicking on the Paint Can icon and "spraying" part of the graphic). Click outside of the picture on some of the text in the document, which will cause you to quit Paint. Notice that the changes you made to your graphic now appear in your document.

  • Click and select the graphic object again (a border should form around the image). Delete the object by pressing the DELETE key.

  • Now place the cursor (the blinking vertical bar) at the bottom or top of your Word document. On the Edit menu, click Paste Special. This time, select the Display as Icon check box. Notice that an icon representing the object now appears in the document—rather than the graphic itself. The icon not only takes up less screen space but also takes up less disk space. An image embedded as an icon may use only half the space a fully-displayed embedded image uses.

  • Double-click the embedded object and the Paint program will start running once again to allow you to see it and edit it as well. Exit Paint.

  • What happens if you print a document with an embedded icon? The icon is printed, just as you see it on-screen. If you want to print it as a real, full graphic, right-click the graphic. Then click Bitmap Image Object and then clickConvert. Unselect the Display as Icon check box. The actual graphic will appear, replacing the graphic's icon. Try this on your own, and when you are finished, delete the object as you did before.

  • Close Paint and Word without saving changes.