OLE (Object Linking and Embedding) technology. Introduction to OLE Technology

Send your good work in the knowledge base is simple. Use the form below

Students, graduate students, young scientists who use the knowledge base in their studies and work will be very grateful to you.

Posted on http://www.allbest.ru/

  • Introduction
  • 1. Concept of OLE
  • 2. Using OLE
    • 2.1 Implementation
    • 2.2 Drag and drop objects from one application to another
    • 2.3 Linking objects
  • Conclusion
  • Literature

Introduction

With the advent of personal computers (PCs), a process of informatization of all types of human activity began: production, science, technology. This process caused by contradictions between a person’s limited abilities to perceive information and powerful streams incoming and stored information.

The development of informatization of society is closely related to the development of computer technology.

When you turn on the PC, the operating system (OS) automatically starts working - a set of software that provides several types of interface, among which an important role belongs to the interface between different types of software.

Technology is used to link documents from different applicationsOLE (Object Linking and Embedding), which means “linking and embedding objects”.

For example, when preparing text in a word processor, there is often a need to place illustrations. For this purpose, a graphic file of a drawing can be used as an object for linking or embedding in a text document.

1. Concept of OLE

OLE (Object Linking and Embedding) is a technology for linking and embedding objects into other documents and objects developed by Microsoft.

OLE allows you to transfer a piece of work from one editing program to another and return the results back. For example, installed on a personal computer publishing system can send some text for processing to a text editor, or some image to an image editor using OLE technology.

The main advantage of using OLE (other than reducing file size) is that it allows you to create a master file, a file cabinet of functions that the program calls upon. This file can operate on data from the source program, which, after processing, is returned to the source document.

OLE is used in processing compound documents and can be used to transfer data between various unrelated systems via a drag-and-drop interface, as well as when performing operations with the clipboard. The idea of ​​embedding is widely used when working with multimedia content on web pages (for example, Web TV), which uses the transmission of images, sound, video, animation in HTML pages (hypertext markup language) or in other files that also use text markup (for example , XML and SGML).

However, OLE technology uses a "thick client" architecture, that is, a networked PC with redundant computing resources. This means that the file type or program being attempted must be present on the client's machine. For example, if OLE operates on tables Microsoft Excel, then Excel must be installed on the user's machine.

OLE 1.0 was released in 1990, building on the DDE (Dynamic Data Exchange) technology used in earlier versions operating system Microsoft Windows. While DDE technology was very limited in the amount and methods of transferring data between two running programs, OLE was able to operate active compounds between two documents, or even embed a document of one type into a document of another type.

OLE servers and clients interact with system libraries using virtual function tables (VTBL). These tables contain pointers to functions that the system library can use to interact with the server or client. OLESVR.DLL (on the server) and OLECLI.DLL (on the client) were originally designed to communicate with each other using the WM_DDE_EXECUTE message provided by the operating system.

OLE 1.1 later evolved into the COM (component object model) architecture for working with software components. The COM architecture was later redesigned as DCOM.

When an OLE object is placed on the clipboard, it is saved in native Windows formats (such as bitmap or metafile) and is also saved in its own format. The native format allows an OLE-enabled program to embed a portion of another document copied to the clipboard and store it in the user's document.

The next evolutionary step was OLE 2.0, which retained the same goals and objectives as the previous version. But OLE 2.0 became an add-on to the COM architecture instead of using VTBL. New features include automation of drag-and-drop technology, in-place activation and structured storage.

In 1996, Microsoft renamed OLE technology 2.0 in ActiveX. Elements were presented ActiveX controls, ActiveX documents and Active Scripting technology. This version of OLE is primarily used by web designers to insert multimedia data into pages.

To summarize, OLE is a set of tools that allows you to easily prepare documents that include data prepared in various applications. Before you can combine data from different applications, those applications must support OLE technology. Standard Windows applications - Paintbrush, Write, Sound Recorder, Cardfile, Object Packager support OLE. In addition to standard Windows applications, many other applications developed by Microsoft and other independent companies, include support for OLE technology. Microsoft Word for Windows 2.0 and 6.0, Microsoft Excel 4.0 and 5.0, ZSoft PhotoFinish 2.0, Designer, FoxPro for Windows, Access and many other packages include support for OLE technology.

2. Using OLE

multimedia interface activex windows

Object linking and embedding allows information from one application to be used in another. To use technology OLE Both the source application and the target application must support OLE.

Using object linking and embedding technology ( OLE), implemented in Microsoft Windows, you can copy and place information from one application to another, while maintaining the ability to edit it in the original application.

Both linking and embedding insert information from one document into another. Further, in both cases, editing the object is performed in the document of the receiving application.

Linking is one of the methods of using data from a source document in a target document. Moreover, any changes to an object in the source document entail changes to this object in all other documents that use this object through communication.

Not all applications support technology OLE. Applications that create objects to transfer are called OLE-servers, which allow you to embed or link other people’s objects - OLE-clients.

Technology OLE can be shown on specific example Copying an AutoCAD drawing view into a Microsoft Word document.

Open the AutoCAD application and select the drawing we need from the list of files (Fig. 1)

Fig.1.

In order to copy a drawing into a text Microsoft editor Word, click the Edit button on the toolbar (Fig. 2) and activate the Copy view line. Open a Microsoft Word document and paste the drawing into the desired place in the text.

Rice. 2

Fig.3

To edit a drawing in Microsoft document Word (Fig. 3), you need to hover the cursor in the drawing field and double-click the left mouse button to enter the server application. This will open an AutoCAD window with the original drawing, in which you can make all the necessary changes (Fig. 4). After pressing the button Save The changes will also be saved in Microsoft Word. If you close the AutoCAD application without first saving the file, a window will appear with the question “Do you want to update Microsoft Word before closing the object?” (Fig.5). The updated drawing is shown in Fig. 6.

At its core, object injection and linking are similar to block insertion and external linking. When copying an object from a destination document to another application, the connection between the latter and the server document is maintained.

Rice. 4

Rice. 5

Rice. 6

When embedding using the OLE method, a copy of the embedded data is placed in the master document. This copy loses its connection to the original document. Embedded data in a master document can be edited by the application in which it was created; but the original document does not change. When embedding objects, no connection to the source file is maintained. Embedding should be used if modification of the source document when editing the composite document is undesirable.

Rice. 7

2.1 Implementation

One of the methods of using data from a source document in a target document. Allows you to paste a copy of an object from one document into another without linking to the original document.

Data embedded in drawings is not updated when the source document is modified. Objects can be embedded in drawings by copying them to the clipboard and then pasting them into a file in another application. This way, for example, you can add a company logo created in another application to a drawing.

For implementation OLE-object to another application you need:

1. Open the document in the source application.

2. Copy the embedded data to the clipboard.

3. Open another application.

4. Press "Edit" And "Insert".

5. Click "OK".

Rice. 8. Implementation OLE-object from MathCAD application to Excel

2.2 Drag and drop objects from one application to another

Data and graphics selected in another application window can be added to the drawing by dragging them across the screen. Both the window of the original application and the window of the other application must be open and not minimized (Fig. 9). Drag and drop between apps is only possible if the second app supports ActiveX technology. Objects moved in this way become embedded (rather than linked). Normally dragging and dropping data is similar to cutting and pasting data sequentially. The data is completely removed from the server document and inserted into the master document. If dragging is performed while pressing the key CTRL, instead of cutting, copying is carried out; a copy of the data is created in the compound document, while the original version remains unchanged.

Rice. 9. Drag and drop OLE-object from MathCAD to Excel

2.3 Linking objects

When linking using the method OLE a link is created between the server document and the compound document. Linking is a convenient way to use the same data in different documents: if the source data is modified, only updating the links is required to change the constituent documents. Most receiver applications can also be configured to update them automatically.

When you link a drawing, you must maintain access to both the source application and the document. If any of them are renamed or moved, the link may need to be re-set.

Rice. 10

In Fig. Figure 11 shows copying an object from MathCAD to Excel in the mode of creating a link between the server document and the compound document. Using the usual method, we prepare a formula from MathCAD for copying, i.e., select the formula, right-click to call up the menu and activate the line Copy. We move the cursor to the desired place of the worker Excel sheet and left-click. Right-click to open a menu in which we activate the line Special insert (red arrow in the picture). In the window Special insert(Fig. 12) press the button To tie and select the desired format (in the field How). Press the button OK. The formula from the MathCAD application is copied to the Microsoft Excel application with a link.

In order to edit an object in Excel, you need to place the cursor on the object field and right-click to call up the menu (Fig. 13), click on the button Open and in the MathCAD worksheet that appears, make the necessary changes to the original object. These changes are automatically made to the Excel worksheet object (Fig. 14).

Rice. eleven

Rice. 12

Rice. 13

Rice. 14

If the application from which the object was transferred is not installed on the computer, then when you try to edit the inserted object in the document (by double-clicking on the object), a window will appear with an error warning (Fig. 15) or (when calling the menu with the right button) - information about the unknown the origin of the server object (Fig. 16).

Rice. 15

Rice. 16

If changes were made to the server document object while the compound document with the associated copy was closed, then when opening the file with the compound document, a window will appear warning you about updating or not updating the data (Fig. 17).

Rice. 17

Similar technology OLE with connection occurs when copying and editing objects, for example, from the MathCAD application to Microsoft Word (Fig. 18).

Rice. 18

Drag and drop is used to copy and move data, create related objects, shortcuts, and hyperlinks between documents in different programs. Each program must support the protocol OLE.

In this case it is necessary:

1. Arrange the program windows so that both the source file and the destination file are open and visible. You need to see the data being dragged and where it will be placed.

2. Select the data, and then, while holding down the right mouse button, drag the selected data to a new location or to another program.

3. Select the desired command in the context menu.

In Fig. Figure 20 shows the result of dragging a formula from Excel into Microsoft Word.

Rice. 19.

Rice. 20.

A drawing image in a Microsoft Word file can be converted, for example, into an icon. The procedure should be as follows:

1. Call up the menu for editing the drawing, but instead of a button Edit ( Edit) press the button Convert(Fig. 21).

2. In the “Object type conversion” menu that appears, put a checkmark in the rectangle of the current type, press the buttons “As an icon” and OK(Fig. 22).

3. An icon will appear in the field where the drawing was (Fig. 23)

The procedures for editing a drawing converted to an icon remain the same as described above, but they are behind the scenes.

Rice. 21

Rice. 22

Rice. 23

In Fig. Figure 24 shows an image of a drawing made using the Microsoft Office Visio design program and copied onto a Microsoft Word document page.

In order to change a drawing, you need to right-click on its field and in the menu that appears, activate the “Visio Object” line and click the “Change” button (Fig. 25). The Visio editor window will appear (Fig. 25), where you can use the appropriate shapes on the toolbar to make the necessary adjustments to the drawing. For example, in Fig. Figure 26 shows the corrected drawing.

Rice. 24

Rice. 25

Rice. 26

Rice. 27

Let's show an example of inserting a diagram from the Microsoft Graph application into the Microsoft Word application. The following operations are used for this:

1. On the toolbar, click the button Insert + An object.

2. In the “Insert Object” window (Fig. 28), select the object type - in our case, “Microsoft Graph Diagram”.

Rice. 28

3. Click OK. The Microsoft Graph work field opens (Fig. 29).

4. Using Microsoft Graph tools, build the desired diagram and left-click on the field outside the picture. The diagram is inserted into the document (Fig. 20).

Rice. 29

Rice. thirty

To edit the diagram, double-click in the object area and call it to make the necessary changes (Fig. 31).

Rice. 31

A similar procedure is used to insert formulas from the Microsoft Equation 3.0 application.

When you double-click on the formula, the Microsoft Equation toolbar will appear and you can make changes to the formula (Fig. 32):

Rice. 32

In Fig. Figure 33 shows a drawing made using the program COMPASS - 3DLTV10 and copied into Microsoft Word.

To edit a drawing, just double-click on the object, thereby calling the server program, and make adjustments to the drawing (Fig. 34).

Rice. 32

Rice. 34

Conclusion

IN course work It is shown that among a number of types of interfaces, the interface between different types of software (PC applications) plays an important role.

To link documents from different applications, such as AutoCAD, Microsoft Word, MathCAD, Microsoft Excel, Microsoft Power Point, Microsoft Equation, Microsoft Office Visio, Microsoft Graph, KOMPAS, etc., OLE (Object Linking and Embedding) technology is used, which means “linking and embedding of objects”.

The main capabilities of OLE technology are considered, and basic techniques for its use are given.

The presence of such a mechanism allows you to transfer a fragment or file of some application to the output document. Day off linked document acquires the properties of a compound document, i.e. a document that has built-in or related objects various formats, created by other applications.

Basic techniques for using OLE technology are shown using specific examples.

The results of the work are presented in the form of a Microsoft Power Point presentation, which allows you to visually accompany a public speech using multimedia effects.

Literature

Microsoft Office 2000: Reference. Ed. Yu. Kolesnikova. - St. Petersburg: Peter, 1999. - 480 p.

Vlasenko S.Yu. Microsoft Word 2002. - St. Petersburg: BHV - Petersburg, 2002. - 992 p.

Dodge M., Stinson K. Effective work with Microsoft Excel 2000. - St. Petersburg: Peter, 2002. - 1056 p.

Computer science. Basic course / Simonovich S.V., Evseev G.A., Murakhovsky V.I., Bobrovsky S.I. - St. Petersburg: Peter, 2001. - 640 p.

Stolyarov A.M., Stolyarova E.S. Word 2002 for yourself.-M.: DMK Press, 2002.- 432 p.

Stotsky Yu. Self-instruction manual Office 2000 - St. Petersburg: Peter, 2000. - 608 p.

7. Shafrin Yu. A 1500 basic concepts, terms and practical tips for users personal computer.- M.: Bustard, 2001.- 272 p.

Posted on Allbest.ru

Similar documents

    Designing and debugging Windows applications to work with external sources data. Functional block diagram of interaction software modules. Description of relationships between tables. Software testing. Requirements for technical support.

    course work, added 05/17/2011

    System requirements for installing Windows XP Professional software, features of its interface, structure, capabilities, practical application and range of users. Characteristics of operating system applications, its reliability.

    presentation, added 02/02/2010

    Microsoft's Shared Source Initiative. The main stages of SSI development. A portal for joint projects and the formation of an interactive community CodePlex. Academic Windows program(WAP) updated version. Learning Resource Pack.

    presentation, added 01/24/2014

    Architecture of Windows NT 5. Priorities for executing program code. Description of the MIDI data format. Installing the driver on the system. Selecting software development tools. Processing WDM driver model requests. Using the DirectKS library.

    course work, added 06/24/2009

    Review of electronic store software, use of the VbScript programming language. Model and physical structure, development of a registration form for a Web site, connecting it to the database. Features of creating a user page.

    course work, added 04/03/2013

    The new operating system is Windows Vista. New intelligent control technology system memory. Ensuring compatibility. Advantages of Windows Vista over Windows XP. Windows Vista software options. Property of mobility.

    abstract, added 11/19/2008

    General characteristics of Windows operating systems and applications. Sharing resources, working with windows, purpose of disk, types of memory, systems for saving and transferring data. The history of applications, their types and features, the order of writing.

    course of lectures, added 06/24/2009

    Study of the features of the organization of multimedia information. Abstract representations. Query languages ​​for multimedia data. Indexing in structured multimedia databases. Analysis of a multimedia interface for content description.

    presentation, added 10/11/2013

    Active Template Library technology. Creating a fully functional control and extending properties. Preparing workspace and resources. User interface design. Adding variables to control animation.

    course work, added 12/09/2015

    Studying technical capabilities operating system Windows XP – OS Windows family NT from Microsoft Corporation. Features of the integrated software. Additional applets in the panel Windows management. Graphical user interface.

When drafting documents, the task of combining documents prepared in different applications often arises. Thus, a report prepared in the Write editor or Word for Windows word processor may contain graphics prepared in the Paintbrush application, drawings created in the Corel Draw application and photographs taken with a scanner and processed in the FotoFinish graphics editor. If you publish an e-newsletter or e-advertisement, you can attach recorded speech or music to the main text document.

How to prepare such a document? Windows 3.1 provides a special mechanism that allows you to combine objects that are the result of different applications in one document. You can create a document that includes not only text, graphics, tables, but also sound accompaniment(music, speech), and even videos. And what’s most amazing is that your document will not be a “bunch” of files in different formats, but will remain a single document.

All of the above miracles became possible thanks to the new technology introduced by Microsoft in the Windows 3.1 operating system. This technology is called OLE.

The mysterious abbreviation OLE comes from the phrase Object Linking and Embedding, which can be translated as linking (connection) and embedding (inclusion, implementation) of objects.

OLE is a set of tools that make it easy to prepare documents that include data prepared in various applications. Before you can combine data from different applications, those applications must support OLE technology.

Standard Windows applications - Paintbrush, Write, Sound Recorder, Cardfile, Object Packager support OLE. In addition to standard Windows applications, many other applications developed by Microsoft and other third-party companies include support for OLE technology. Microsoft Word for Windows 2.0 and 6.0, Microsoft Excel 4.0 and 5.0, ZSoft PhotoFinish 2.0, Designer, FoxPro for Windows, Access and many other packages include support for OLE technology.

7.1. A little about terminology

Like any new technology, OLE technology has led to the creation of new terminology. In this section, we will provide an explanation of the basic terms used in OLE technology.

Server

A server is an application that creates objects that are included or linked to another application. Typically, graphic, text and sound editors act as server applications.

Included in the operating system Windows versions 3.1 graphics enabled paint editor brush and sound editor Sound Recorder. Both of these applications support OLE technology and can be used to create objects that can be embedded in other documents.

Client

A client is an application or document that displays or includes objects prepared by server applications.

Typically, the client application is a text editor or database management system, and the document containing the embedded object is a text document or database.

Typical client applications are Write, Microsoft Word for Windows, Cardfile, Access, and FoxPro for Windows.

Object

An object is understood as information prepared in any application that supports OLE technology. Examples of objects include Paintbrush graphic images, speech or music recorded with the Sound Recorder application, videos prepared in Microsoft Excel tables.

When you create a document, you can insert or link objects created in various applications to it.

Compound documents

The main document can combine data prepared in different applications. The main document is prepared in the client application.

Embedding

When you perform an embed operation, an object prepared in the server application is embedded in a document prepared in the client application. After performing the embedding operation, the document will contain an embedded object within it. The document file size will increase, but you won't have to remember where the files containing the source objects are located.

When performing an embed operation, you should not care what format the embed object was prepared in. The main thing is that the client application and server application support OLE technology.

An embedded object can contain an image or icon that can be displayed by a client application at the location in the document where the embedded object is located.

To edit an embedded object, simply double-click on the image of this object in the document. When you double-click the mouse, the operating system starts the server application and loads the object into it. Once you've finished editing it, you can close the server application. The server application will write all the changes you make to the main document.

Linking

Unlike the embedding operation, when performing a linking operation, not the object itself is placed inside the document, but only a link to it (the path of the source file prepared by the server application).

Using the link operation instead of the insert operation has two important advantages.

  • If an object prepared by a server application is used in multiple documents (client applications), then when you change the object, all documents that contain a reference to that object are automatically updated.
  • Since only a link to the object being linked is placed in the document, the document size is smaller than when the object is included in the document.

However, the linking operation also has its disadvantages. You must choose whether you will use the insert operation or the link operation.

  • Since linked objects are stored separately from the document to which they are linked, instead of a single file, the document will consist of many files located in different directories.
  • If you move a file containing a linkable object to a different directory, you need to change the link in the document to the moved object.

Packaging

The Windows 3.1 operating system provides the ability to insert into a document an object prepared by an application that does not support OLE technology. The Object Packager application, located in the Accessories group of the Program Manager application, is designed for this.

Using the Object Packager application, create a package containing an icon (that you can draw yourself), the path to the server application, and the path to the file containing the object file. Then embed this package into your main document.

You can perform the same actions with an object inserted into a document as a package as with a regular inserted object. After double-clicking on the package icon, the server application starts and you can edit the packaged object.

7.2. Using OLE technology

Here are some examples of using OLE technology to create a main document containing objects prepared in various applications.

Preparing an email or advertisement

Using OLE technology, you can quickly and efficiently prepare email or electronic advertising, which you can send via modem (e-mail) or floppy disks to all interested parties.

Your letter or advertisement can contain text, images and even audio (music or speech) in one file. In this case, the email will be a single file, which you can use a text editor to view.

Let's say your company produces musical instruments, such as balalaikas or guitars. You need to prepare an advertisement for your product and send it to potential buyers.

Using OLE technology, you can prepare the text of an advertising message in the word processor Word for Windows or the Write editor, prepare an image of a balalaika in Paintbrush, use the Sound Recorder application (and the corresponding equipment, such as SoundBlaster or Covox boards) to record a small pleasant melody played on balalaika, and then merge all these files (objects) together. To do this, you can embed Paintbrush and Sound Recorder application objects into the text of the Write application. We will describe the entire creation process advertisement.

Prepare an advertisement text in the Word for Windows 2.0 word processor, which will include an image of a balalaika and a sound recording. Write the prepared document to the RECLAMA.DOC file.

Launch the Paintbrush application and draw an image of a musical instrument in it. If you have a scanner, take a photo of the balalaika, scan the photo and save its image to a file. Then load the image file into the Paintbrush editor.

Select the area of ​​the image that needs to be included in the advertising brochure (see Fig. 7.1). Write the selected area of ​​the image to the Clipboard buffer. To do this, select the “Copy” line from the “Edit” menu.

Rice. 7.1. Drawing of a musical instrument

Switch to your word processor and place your cursor where you want to place the image of the musical instrument in the ad.

Select the line "Paste Special..." from the "Edit" menu. The "Paste Special" dialog box will appear on the screen (see Fig. 7.2).

Rice. 7.2. Paste Special dialog box

The "Data Type" list lists the formats in which you can embed information located in the Clipboard buffer. To embed a picture as a Paintbrush object, select "Paintbrush Picture Object" from the list. If you select Bitmap or Picture format from the list, the drawing will be embedded as a Microsoft Draw object rather than a Paintbrush object.

To embed a picture into a document, click the "Paste" button. The drawing will be embedded in the document (see Fig. 7.3). Once you select a picture, you can resize it. After embedding the picture original file can be deleted to save space since it is recorded in a Word for Windows document.

The "Paste Link" button allows you to link a drawing to a document. In this case, the object (drawing) is not embedded in the document, but is attached to it. In this case, the original file with the drawing is necessary and cannot be deleted.

The picture we have built into the document can be easily changed. To do this, double-click on the picture inside the document. The Paintbrush application will automatically launch and our drawing will be loaded into the editing field.

Once you have made all the necessary changes to it, select the "Update" line from the "File" menu of the Paintbrush application. The embedded picture will be updated. You can now close the Paintbrush graphic editor and return to the word processor window by selecting "Exit & Return to RECLAMA.DOC" from the "File" menu.


Then, in the Sound Recorder application, select "Copy" from the "Edit" menu. The recorded melody will be copied to the Clipboard buffer. You can end the Sound Recorder application, we won't need it anymore.

Switch back to the Word for Windows word processor. Place the cursor at the place in the advertising text where you should insert the icon to play the recorded melody. Select the line "Paste Special..." from the "Edit" menu. The familiar “Paste Special” dialog box will appear, but other formats will be included in the “Data Type:” list (see Figure 7.4).

Rice. 7.4. Embedding a sound object

Select the "Sound Object" format from the "Data Type:" list and click the "Paste" button. An icon for the Sound Recorder application will appear inside the document (see Figure 7.5).

Rice. 7.5. Sound object icon

If you try to insert Clipboard content into a document as a Bitmap or Picture, only the icon will be written to the document. Sound capabilities will not be implemented. And when you click on such an icon with the mouse, Microsoft Draw will launch.

You can change the size of the Sound Recorder application icon and move it to another place in the advertising brochure (see Fig. 7.6). To play the built-in melody, place the mouse pointer on the icon and double-click with the left mouse button.


If you need to change the recorded melody, select the icon and select the "Sound Object..." line from the "Edit" menu. The Sound Recorder application will automatically launch and the melody will be loaded into it.

After making the necessary changes to the melody, select the "Update" line from the "File" menu of the Sound Recorder application and close it. You will be taken back to the Word word processor.

Record all changes made to the advertising brochure by selecting the “Save” line from the “File” menu of your word processor. Now the RECLAMA.DOC file contains an advertising brochure containing a drawing and a small melody. You can send this file to all potential buyers so they can read, view and listen to your prospectus.

Preparing multiple documents with pictures

In the previous section, we prepared a document containing heterogeneous objects in one file. This method is useful when the document is intended to be distributed and does not contain objects that are used in multiple documents.

If you need to prepare several documents containing the same objects (images, sounds, tables prepared in Microsoft Excel), OLE embedding technology is not suitable. When you need to make changes to a drawing, you will have to adjust the drawing separately in each document.

For such cases, OLE technology provides another mechanism for combining documents, called linking. When linking, the object is not copied inside the document. Only a link to the source file is recorded in the document. Several different documents may contain references to the same objects.

This mode of using OLE technology allows, firstly, to economically use the computer's disk memory, since a copy of an object is not created for each document, and secondly, it provides a convenient way to change objects.

When you change a source object that is linked to multiple documents, its appearance in the documents changes automatically.

Let's consider the process of preparing two documents (reports) in Microsoft Word for Windows 2.0, containing the same histogram created in the Paintbrush graphic editor.

First, prepare a histogram to include in your documents. To create a histogram, use the Paintbrush graphics editor. Write the finished histogram to the GIST.PCX file (see Fig. 7.7).

Rice. 7.7. Histogram prepared in Paintbrush

Now launch Microsoft Word for Windows 2.0 and prepare your first document. To include a histogram in your document, switch to Paintbrush and copy the entire drawing into Clipboard. Then switch back to Word for Windows. You don't have to close the Paintbrush application yet.

Move the cursor to the place in the text where you want to insert the histogram, and select the line “Past Special...” from the “Edit” menu. The already familiar “Paste Special” dialog panel will appear on the screen (see Fig. 7.8).

Rice. 7.8. Linking a Graphic Object to a Document

But now, unlike the previous example, select the "Bitmap" or "Picture" format from the list of available formats. The "Paste Link" button, which was previously grayed out, is now available. Click on it.

The histogram you drew will appear in the edit field of the first document. If necessary, resize it and move it to a different position. Save the finished document in the file DOC1.DOC.

Create a second report, also including the histogram from the GIST.PCX file. To do this, repeat all the steps we described above.

When you link objects to a document, the source objects are not written to the document file, as when performing a linking operation. The document file records only the visual representation of the object and a link to the object's source file, as well as the name of the application in which it was prepared.

To edit a linked object, place the mouse pointer on it and double-click the left mouse button. The corresponding application will launch and the source file of the object will be loaded into it.

Another method is more convenient. Suppose you need to add one more interval to the histograms included in the DOC1.DOC and DOC2.DOC reports. To do this, launch the Paintbrush graphic editor and load the GIST.PCX file into it. Make the necessary changes (see Fig. 7.9) and save the file by selecting the "Save" line from the "Edit" menu. Close the Paintbrush application; you won't need it anymore.

Rice. 7.9. Modified histogram

How will the documents associated with the GIST.PCX file and the Paintbrush application be updated? This depends on your Word for Windows 2.0 settings. Select the "Links..." line from the "Edit" main menu. The "Links" dialog box will appear on the screen (see Fig. 7.10).


Rice. 7.10. Links dialog box

The Links dialog box contains a "Links:" list that lists all OLE objects associated with the document. Each row in the list represents one relationship (a relationship to one OLE object). The line consists of the name of the application in which the OLE object associated with the document was prepared, the full path of the OLE object source file, object-dependent parameters, and the OLE object update mode - Manual or Automatic.

If you need to find a link to an OLE object in the list and you do not remember the name of the source file of this object, before calling the "Links" dialog box, select the object. Necessary connection will be highlighted in color.

If the link update mode is set to "Automatic", the OLE object view is updated automatically when the main document is loaded. In the manual update mode (“Manual”) you need to manually indicate the need for an update.

You can change the update mode. Select a link from the "Links:" list and change the update mode using the "Update" switch. In the "Automatic" position the automatic update mode is set, and in the "Manual" position - manual update.

To force update an OLE object linked in the "Manual" or "Automatic" mode, select the appropriate links from the list. You can select multiple connections at once. Then click the "Update Now" button.

The "Open Source" button allows you to edit the associated object. Select a link from the "Links:" list and click the "Open Source" button. The server application will start and the source file of the OLE object associated with the main document will be loaded into it. The changes made will be reflected in all documents containing a link to this object.

For links established in automatic update mode, any changes made to the OLE object's source file are automatically reflected in the main document. Links in manual update mode are not automatically updated and require a forced update (the "Update Now" button in the "Links" dialog panel).

Any linked OLE object can be frozen by turning on the "Locked" switch for the corresponding link. After this, in the "Links:" list, this link is marked as frozen - "Locked", and changes in the source files of the linked object do not in any way affect the representation of the object in the document.

If the link is no longer needed, select it and click the "Cancel Link" button. After removing the link, the external representation of the object will remain, but double-clicking the mouse will no longer cause the server application to launch.

Thus, after deleting the connection with a sound file prepared in the Sound Recorder application, you will no longer be able to play this sound, although the Sound Recorder icon will remain in the main document.

If you delete the source file of a linked object, for example in our case GIST.PCX, the object will still appear in the document, but when you decide to edit it, you won't be able to do anything. In this case, Word for Windows 2.0 will display the following message (see Figure 7.11).

Rice. 7.11. Word can't edit Paintbrush object

It's not just the delete operation that breaks the connection between the object and the document. Moving the object's source file to a different directory also breaks this relationship. OLE technology version 2.0, developed in Microsoft Word for Windows 6.0 and Excel 5.0, allows you to freely move related objects and documents without disrupting communication.

Thus, when using the linking method, it is best to store all documents and source files of linked objects (pictures, sounds, tables) in general catalog. If this is not possible and you need to move the object's source file to another directory, you must manually configure all document connections with this object.

To set up a link after moving an OLE object, select the object and select the "Links..." line from the "Edit" menu. In the "Links" dialog box that opens, the corresponding link in the "Links:" list will be highlighted in color. Click the "Change Link..." button.

Rice. 7.12. Change Link Dialog Bar

The "Change Link" dialog box that opens (see Figure 7.12) allows you to change the name of the server application in which the OLE object was prepared, the path of the OLE object's source file, and additional information depending on the type of object.

In our case, we only need to change the path of the OLE object source file. Enter new way in the "File Name:" editing window and click the "OK" button.

Green Monster and Word for Windows

If you're tired of editing documents in Word for Windows 2.0, you can have some fun by watching a little funny movie about a scary green monster and Word for Windows. To do this, just perform a few trivial steps that are not described in the documentation that comes with Word for Windows 2.0.

We took the liberty of filling this “gap” and described the procedure for summoning the green monster to the screen.

  • Launch Word for Windows 2.0
  • From the "Tools" menu, select the "Macro..." line. The Macro dialog box will appear on the screen.
  • In the "Macro Name" field, enter the string "spiff" and click the "Edit" button
  • In the macro editing window that appears, delete the lines “Sub MAIN” and “End Sub” so that only one remains empty line
  • From the "File" menu, select the "Close" line. Word will ask for permission to save the changes.
  • Click "Yes" button From the "Help" menu, select the About line and click on the "Word" icon located in the left top corner

"About" panels

You will see little men and the terrible fat green monster W.P., defeated to the general rejoicing of the men by the word processor Word for Windows (see Fig. 7.13).

Rice. 7.13. Horrible green monster W.P. After defeating the monster, fireworks begin and a list of text developers appears. Word processor

for Windows. Sometimes when using video adapter drivers on Windows that have a high resolution

(800*600 pixels or more) the green monster does not appear. If you still want to look at it, replace the video adapter driver with a standard VGA driver. After viewing, change the video adapter driver back.

Cardfile application and OLE technology

Earlier in the chapter "Standard Windows Applications" we already studied the capabilities of the Cardfile electronic file cabinet. Now we'll return to this application again and look at Cardfile's ability to use OLE technology.

  • The electronic card file Cardfile supports OLE technology. However, unlike other applications, Cardfile imposes several restrictions on the use of OLE technology. An OLE object can only be embedded or linked internally information field
  • cards
  • Only one OLE object can be placed inside each card
  • The Cardfile app only works as a client, so you can't directly embed a card or file cabinet into documents prepared by other apps. When inserting an OLE object, you must enable, in which you can insert OLE objects, but you cannot edit the text of the card information field

Let's consider the procedure for embedding a terrain plan prepared in the Paintbrush graphic editor into the information field of the card. As an example, let's take the SAMPLE.CRD address file, described in the "Electronic Cardfile" section of the "Standard Windows Applications" chapter.

Launch the Cardfile application and load the card file SAMPLE.CRD. Open the card into which you want to embed a picture. Let this be the card of Alexander Vladimirovich Volchansky.

Then download the Paintbrush graphic editor and draw in it a plan of the area where Alexander Vladimirovich Volchansky lives. Write the drawn plan to the PLAN.BMP file.

If you have prepared a site plan previously, load it into Paintbrush. Select the section of the plan that needs to be placed on the card and copy it to the Clipboard (see Fig. 7.14). To do this, use the "Copy" line from the "Edit" menu.


Rice. 7.14. Preparing a graphic image

Now let's start embedding the picture located in the Clipboard buffer into the information field of the card. Before embedding OLE objects, switch Cardfile to graphic mode by selecting the “Picture” line from the “Edit” menu (see Fig. 7.15). In Cardfile graphical mode it is impossible to edit card text. When you're done embedding the OLE object, change the Cardfile back to text mode by selecting "Text" from the Edit menu.

Rice. 7.15. "Edit" menu

Select the line "Paste Special..." from the "Edit" menu. The "Paste Special" 7.16 dialog box will appear on the screen. This dialog box contains the "Data Type:" list. The contents of this list depend on the contents of the Clipboard and which application wrote the information to the Clipboard. To embed a picture into a card as an object of the Paintbrush graphic editor, select the "Paintbrush Picture Object" line from this list.

WITH right side The dialog panel contains the "Paste", "Paste Link" and "Cancel" buttons. To embed an OLE object, click the "Paste" button, and to link the object to a card, click the "Paste Link" button. If you do not want to embed the OLE object, click the "Cancel" button.

Rice. 7.16. Paste Special dialog box

Click on the "Paste" button. The area plan will be built into the card and appear in the information field. Move the plan image to the bottom of the card so that the address remains visible (see Figure 7.17).

Rice. 7.17. Inserting a Graphic Image

After embedding the object, the original PLAN.BMP file can be deleted, since all the necessary information is recorded in the card file. If instead of the “Paste” button we clicked the “Paste Link” button, then the source file should be saved.

You can edit the plan image embedded in the card. To do this, switch to graphics viewing mode by selecting the "Picture" line from the "Edit" menu. Double-click the left mouse button on the plan image. The Paintbrush editor will launch and the plan image will automatically load into it. Once you have made all the necessary changes, update the built-in object. To do this, from the "File" menu, select the "Update" line. Then close the Paintbrush application by selecting "Exit & Return to SAMPLE.CRD" from the "File" menu.

If you decide not to modify the built-in object, select "Exit & Return to SAMPLE.CRD". Paintbrush will ask for confirmation to update the embedded graphic. Click the "No" button to refuse the update.

Using the Object Packager Application

Object Packager has a valuable feature - it allows you to embed objects prepared by applications that do not support OLE technology. There is only one limitation left - the package can only be embedded in applications that support OLE technology.

Instead of embedding or associating an object with a document, Object Packager allows you to create a new object, called a package, which can then be embedded in a document. The package embedded in the document looks like an icon.

A package can contain either an embedded or linked object, but the package itself can only be embedded in a main document.

The package has all the properties of an embedded OLE object. To activate it, you need to place the mouse pointer on the package icon and double-click with the left mouse button.

You can use the Object Packager application (see Figure 7.18) in the following cases:

  • When you need to include an icon (package) in the main document, which, when selected, displays a subordinate document
  • When you need to include an icon (package) in the main document, which, when selected, displays part of the subordinate document. This opportunity is provided only for subordinate documents (objects) prepared in applications that support OLE technology
  • When you need to create a package containing an MS-DOS command. When choosing such a package, you can organize the execution MS-DOS commands or launch the application

You can also determine for yourself appearance icon representing the embedded package, and also specify a caption under the icon.


Rice. 7.18. Object Packager Application

Embedding Windows and MS-DOS commands

Object Packager allows you to embed a package containing Windows command or MS-DOS. Double-clicking on the icon of such a package launches a Windows application or executes the corresponding MS-DOS command. Let us describe the procedure for creating and embedding such an object.

Launch the Object Packager application. From the "Edit" menu, select the line " Command Line". A dialog panel of the same name will appear on the screen (see Fig. 7.19).

Rice. 7.19. Command Line dialog box

In the "Command:" editing window, enter the command that the created package will contain. Let's say you want to launch the Windows help subsystem and load the software database into it. Program application Manager. Then enter the following command:

WINHELP PROGMAN.HLP

Click "OK" button. The Command Line dialog box will close, and the line "WINHELP PROGMAN.HLP" will appear in the --Content-- field of the main Object Packager application window, displaying the command you entered.

You can specify more than just Windows application startup commands. It is possible to call any MS-DOS commands and any programs, both Windows applications and MS-DOS programs, including the ability to launch MS-DOS batch files.

Now let's select an icon for our application. To do this, click on the "Insert Icon..." button in the "--Appearance--" field. The "Insert Icon" dialog box will appear (see Figure 7.20).


Rice. 7.20. Insert Icon dialog box

It presents the icons contained in the Program Manager application. You can select any of the icons presented. If none of the icons suits you, specify in the "File Name:" edit field the name of the file containing other icons. Typically, icons are written in files with the extensions ICO, EXE and DLL. It is most convenient to use the option to select from a list when entering a new file name. A list of files on your computer disks containing icons can be obtained by clicking the "Browse..." button.

After selecting an icon from the "Current Icon:" list, click the "OK" button. The "Insert Icon" dialog box will close, and the image of the selected icon will appear in the "--Appearance--" field.

If necessary, you can specify a signature that will be displayed under the icon. To enter a signature, select the "Label..." line from the "Edit" menu. In the dialog box that appears, enter a signature line, in our example the line “Help”, and click the “OK” button. The entered signature will appear in the "--Appearance--" field under the icon (see Fig. 7.21).


Rice. 7.21. Including MS-DOS commands in the package

At this point, the creation of the package can be considered complete. Write it to the Clipboard clipboard by selecting "Copy Packadge" from the "Edit" menu. The "Copy" line, typically used to copy an object into the Clipboard, writes only the external representation of the package - the icon and label - to it. The contents of the package are not copied.

Launch the application and open the document into which the package will be inserted. For example, launch Word for Windows 2.0 and open your document. Move the cursor to the position where the package will be embedded and select the "Paste" line from the "Edit" menu. The package will be embedded in the edited document in the form of an icon with a signature (see Fig. 7.22).

Rice. 7.22. Appearance of the built-in package

Double-click on this icon. Help will automatically launch Windows system- Microsoft Windows Help and the database for the Program Manager application will open (see Fig. 7.23).


Rice. 7.23. Launching Windows Help

You can change the built-in package: change the icon, the caption under it, or the command being executed. Select the package you want to change by clicking on it. Then from the "Edit" menu select the "Package Object..." line. The Object Packager application will launch and the package will be open for editing. After entering all necessary changes, select "Update" from the Object Packager "File" menu. The package embedded in the document will be updated and you can close the Package Object application.

Changing the package icon

If none of the existing icons suits you, you can draw your own using the Paintbrush application. To independently develop or change an existing icon, go to the built-in package modification mode. As mentioned above, to do this you need to select the corresponding package and select the line "Package Object..." from the "Edit" menu.

Then, in the Package Object application window that opens, go to the "--Appearance--" field and copy the package icon to the Clipboard by selecting the "Copy" line from the "Edit" menu.

Launch any graphics editor, such as Paintbrush. From the "Edit" menu, select the "Paste" line. The package icon will appear in the Paintbrush edit field. You can edit it or draw a new one. Select the finished drawing and record it in Clipboard by selecting the “Copy” line from the “Edit” menu.

Quit Paintbrush and switch back to the Package Object application window. Make the "--Appearance--" field active again. Connect a new icon by selecting the “Copy” line from the “Edit” menu. The icon created in the Paintbrush graphics editor will appear in the "--Appearance--" field, replacing the old icon.

The only drawback of this icon replacement is the impossibility of changing the signature under the icon. Such a signature will have to be drawn in the graphic editor Paintbrush.

To make the new icon appear in the main document, update the built-in package by selecting "Update" from the "File" menu. Finally, close the Package Object application.

Creating a batch from an entire document

A package may contain an embedded object or a reference to an object. To create a package that contains an embedded object, you can use either the Package Object application or the File Manager application. To create a package containing a linked object, you must use the File Manager application.

Let's look at the process of creating a package containing an embedded object using the example of a document prepared in the Notepad editor. Let's embed the package into a document prepared by the word processor Word for Windows 2.0.

Note that the Notepad text editor itself does not support OLE technology and a document prepared in it cannot be used as an object. To embed such a document in another application, you must use the Package Object and create a package.

Launch Package Object and select the "--Content--" field. Then from the "File" menu select the "Import..." line. The "Import" dialog box will appear on the screen (see Fig. 7.24).


Rice. 7.24 Dialog panel "Import"

Select from the "Drives:" and "Directories:" lists the full path of the directory containing the document that will be used to create the package. From the "File Name:" list, select a document file name or enter it in the "File Name:" edit field.

Let's say you want to create a package from the DOCLAD.TXT document. Enter its name in the "File Name:" field. Click "OK" button.

The name of the selected document file is displayed in the "--Content--" field, and the icon of the application in which the document was created appears in the "--Appearance--" field. The name of the application used to create the document is determined based on the application's association with the document's file name extension. In the first volume of the "Personal Computer - Step by Step" series, we looked at binding an application to file extensions in the "File Manager Program" section.

The Notepad text editor is attached to the TXT extension, so the Notepad application icon appears in the "--Appearance--" field. And Notepad will be used to display and edit the DOCLAD.TXT document.

If necessary, replace the package icon by clicking on the "Insert Icon..." button and change the label under the icon by selecting the "Label..." line from the "Edit" menu.

When the package is ready, copy it to the Clipboard by selecting "Copy Package" from the "Edit" menu. Switch to the document in which the package will be embedded and embed it in the desired location.

Double-click the built-in package icon. Depending on which document is embedded in the package, different actions are performed - viewing graphic image, play sound, launch application.

In our case, the package contains text file and when you double-click on the icon of this package, the Notepad text editor is launched and the DOCLAD.TXT document is loaded into it.

A package can be created not only from a text or graphic document. You can also select an executable file to create the package. If an executable file is selected, the "--Appearance--" field displays its icon or the Object Packager application icon. After embedding such a package into the main document, double-clicking on the package icon launches the corresponding program.

If no application is associated with the selected file, then the Object Packager application icon appears in the "--Appearance--" field. However, you can embed such a package into a document, but it will not make you happy. After double-clicking on the icon of such a package, a message appears stating that no application is associated with this file.

File Manager and Package Embedding

The File Manager application we already know can also be used to create a package and embed it in a document. In this case, you can package the embedded document or just a link to it. There are three different ways to use File Manager to create a package.

  • Using Clipboard, copy a document from the File Manager application to the Object Packager application.

Create a package and embed it in the main document

Launch File Manager and select the name of the file containing the document to create a package. From the "File" menu, select the "Copy" line. In the dialog box that appears, move the "To:" switch to the "Copy to Clipboard" position and click the "OK" button.

Open the Object Packager application. Switch to the "--Content--" field. When creating a package, you can either embed the entire document into the package, or just a link to it.<имя выбранного файла>".

To embed the entire document into the package, select the "Paste" line from the "Edit" menu. The resulting package will contain a copy of the original document. In the "--Content--" field the line "Copy of<имя выбранного файла>".

If you need to create a package that contains only a link to the source document, select the "Paste Link" line from the "Edit" menu. In the "--Content--" field the line "Link of

  • If necessary, change the package icon and label under it, then copy the prepared package into Clipboard and embed it into the document by selecting the "Paste" line from the "Edit" menu from the client application menu. An embedded package will be indicated by its icon. To view a packaged document, double-click on the package icon.

Most applications that support OLE allow you to create a package without using the Object Packager application. To do this, copy the document from the File Manager application to the Clipboard, and then embed it into the main document

Launch File Manager and select the name of the file containing the document to create the package. From the "File" menu, select the "Copy" line. In the dialog box that appears, move the "To:" switch to the "Copy to Clipboard" position and click the "OK" button.

Open the document into which you want to embed the package. If you need to embed a package that contains only a link to the source document, select the "Paste Link" line from the "Edit" menu. To embed a package in which the entire source document is embedded, select the "Paste" line from the "Edit" menu.

  • The package is automatically created and embedded in the main document as an icon. To view a packaged document, double-click on the package icon.

However, there is another, easier and more elegant way to embed a package into the main document.

To place a package containing an embedded object into a document, select the corresponding file with the left mouse button and, without releasing the button, drag the file icon to the place in the main document where the package should be embedded. Release the button. A package icon will appear at the insertion location.

If you want to embed a package containing only a link to an object, then hold down the keys while dragging (Drag and Drop) the object file icon from the File Manager application into the main document .

Creating a package from part of a document

Sometimes you want to embed a package into a master document that contains only part of a subordinate document. To do this, the embedded document must be prepared by an application that supports OLE technology.

Launch the server application and copy part of the embedded document to the Clipboard by selecting the "Copy" line from the "Edit" menu. Switch to the Object Packager application. In the main window of the Object Packager application, go to the "--Content--" field.

To create a batch containing a copy of the information recorded in the Clipboard, select the "Paste" line from the "Edit" menu. If you want the package to contain only a link to the source (subordinate) document, select the "Paste Link" line.

Write the prepared package into Clipboard and then embed it in the main document.

Retrieving a document (object) from a package

If you used File Manager to create the package, you can extract the contents of the package and write it to a file. To do this, click on the package icon and select the line "Package Object..." from the "Edit" menu. The package you select will be loaded into the Object Packager application.

Open the "File" menu and select the "Save Contents..." line. The "Save Contents" dialog box will appear on the screen. Select the directory where the file will be written and enter its name. Then click "OK". The object embedded in the package will be written to a file.

7.3. OLE version 2.0

OLE version 2.0 is easier to use and provides new capabilities for linking objects. OLE 2.0 allows applications to interact more closely with each other. At the same time, the user can pay more attention to creating and managing information, as the linking procedure is simplified.

OLE version 2.0 is fully compatible with previous versions. Applications that support OLE 2.0 can communicate with applications that support OLE 1.0.

New features in OLE 2.0 include:

  • Activating an object locally. Allows you to access an enabled object locally, without switching to another window or application.
  • You can record, display, play and edit included objects while remaining in the main application (document).
  • Support for nested objects. Allows you to interact with objects nested within other objects
  • Support for Drag and Drop mechanism. You can now drag an object from one application to another using the mouse. This automatically embeds the object into a document of another application.
  • Independent connections. Links between included objects that are not stored on disk as files are allowed. This allows objects to be embedded within the same or different applications, regardless of the presence of the file
  • Adaptable connections. The connection between objects and the main document is maintained in the event of copying and moving operations

Logical pagination. Allows you to include objects in your document that overlap the page border

New software developed for Windows - the word processor Microsoft Word for Windows 6.0 and the spreadsheet Microsoft Excel 5.0 - support OLE version 2.0 technology. Let's look at the new features of OLE version 2.0 using these applications as an example. We will not cover Microsoft Excel 5.0 in detail in this volume. Excel package

5.0 we will specifically devote a separate volume in the series “Personal Computer - Step by Step”.

Local activation

Launch Microsoft Excel 5.0. Open the BOOKST.XLS document, located in the EXAMPLES directory, which contains the examples included with Excel 5.0.

An interface panel with four buttons will appear on the screen. To view a histogram of book sales, click the "Sales Chart" button. A temporary dialog box will appear asking you to specify the year to plot the histogram. Select 1993 and click OK. The temporary dialog panel will disappear, and a histogram of product sales for 1993 will appear on the screen.

From the "Format" menu, select the "Char Type..." line. In the dialog box that opens, you can change the appearance of the histogram, for example, make it three-dimensional.


Select the resulting histogram using the mouse. Copy it to the Clipboard buffer (see Figure 7.25).

Let's now embed this histogram into the SAMPLE.DOC document prepared in Word for Windows 6.0. To do this, place the cursor in the position where you want to place the icon and select the “Paste Special...” line from the “Edit” menu (see Fig. 7.26).


Rice. 7.26. Embedding an object (histogram) in a document

The "Paste Special" dialog box will appear on the screen. The appearance of this panel is noticeably different from the similar dialog panel of the word processor Word for Windows version 2.0. At the top of the dialog panel, in the "Source:" field, the name of the server application in which the document was prepared is displayed. Below the name of the server application is the name of the document in which the source object is located.

Instead of two buttons “Paste” and “Paste Link”, which allow you to either embed an object located in the Clipboard or place only a link to the object in the main document, “Paste” and “Paste Link” switches have appeared.

To embed an object from the Clipboard into a document by writing a copy of the object to the document file, move the switch to the "Paste" position. If you need to connect an object by reference, the switch must be in the "Paste Link" position.

Word for Windows version 6.0 opens up another possibility - the embedded object can be displayed in the main document as an icon. Previously, to achieve this effect, you first had to create a package using the Object Packager application, and then embed the package in the main document.

The presentation mode of the OLE object in the main document is set by the "Display as Icon" switch. To have the OLE object represented only as an icon in the main document, enable this switch.

The "As:" list corresponds to the "Data Types:" list in the "Paste Special" dialog box of the Word for Windows 2.0 word processor. To include a histogram located in the Clipboard buffer as an Excel 5.0 object, select the line "Microsoft Excel 5.0 Chart Object" from the "As:" list (see Figure 7.27).


Rice. 7.27. Paste Special dialog box

Let's embed a histogram located in the Clipboard into the text of a document prepared in the word processor Word for Windows 6.0 as a Microsoft Excel 5.0 object. To do this, align the controls located in the "Paste Special" dialog panel with Figure 7.27.

Click "OK" button. A histogram prepared in Excel 5.0 will appear in the text of a document edited in Word 6.0 (see Figure 7.28). You can print our document from Word for Windows. The histogram will also be printed.


Rice. 7.28. Histogram built into a document prepared by Word for Windows 6.0 word processor

If you need to edit the histogram by adding new intervals to it, or simply rotate it in 3D space, place the mouse pointer on it and double-click the left mouse button.

Previously, when we used OLE technology version 1.0, the server application (in our case Excel) was launched and the selected OLE object was loaded into it.

Microsoft Word for Windows 6.0 and Excel 5.0 support Enhanced OLE technology version 2.0. After double clicking on the histogram we do not switch to Excel window 5.0, but we remain in the Word for Windows 6.0 window. However, all menus and buttons (toolbar) are replaced by the corresponding Excel 5.0 menus and buttons (see Figure 7.29). And we seem to find ourselves in Excel 5.0 without leaving the word processor Word for Windows 6.0.


Rice. 7.29. Editing an object in place

Let's take advantage of the capabilities provided to us by the Excel 5.0 application and perform a three-dimensional rotation of the histogram.

To do this, select the line “3-D View...” from the “Format” menu. In the dialog box that appears, use special buttons with arrows, change the appearance of the histogram.

When you have finished changing the histogram, go back to normal mode word processor Word for Windows 6.0. To do this, simply click the mouse outside the built-in object (in in this case outside the histogram).

The result of editing the histogram can be seen in Figure 7.30.


Rice. 7.30. Result of histogram editing

7.4. Embedding TrueType fonts

If you are preparing a document that must be viewed by several people on other computers, or if the document is printed in another organization, then the problem of using TrueType fonts arises. Each workstation where a document is to be viewed or printed must have the TrueType fonts used in the document installed.

When a document is viewed or edited on a computer that does not have the font set used in the document installed, the missing fonts will be replaced and the document may change its appearance. In most cases, this situation is extremely unfavorable. All efforts to use WYSIWYG technology when preparing a document will thus be nullified.

To solve this problem, the Windows 3.1 operating system includes a special mechanism called font embedding technology.

Font embedding technology allows you to embed TrueType fonts used in that document inside a document. When such a document is viewed, edited, or printed on a computer that does not have the required fonts installed, the fonts embedded in the document are temporarily included and used when viewing and printing the document.

The Microsoft Word for Windows 2.0 word processor, the Write editor, and other similar editors do not have this feature. Therefore, previously it was necessary to ensure that everyone who used the document had the same fonts installed.

The new version of the word processor Microsoft Word for Windows 6.0 supports the technology of embedding TrueType fonts into prepared documents.

To embed TrueType fonts in a document prepared in the Microsoft Word for Windows 6.0 word processor, when saving the document, select the "Save As" line from the "File" menu. The "Save As" dialog box will appear on the screen (see Fig. 7.31).


Rice. 7.31. Save As dialog box

Select from the "Driver:" and "Directories:" lists the drive name and directory path for recording the document you are editing. In the "Save File of Type" field, select the line "Word Document", which means that the document will be saved in Word format for Windows 6.0. From the "File Name" list, select the name of the file in which the document will be saved. If you want to create a new file, enter its name in the "File Name" edit field.

Then you should indicate that the TrueType fonts used in it must be embedded in the document. To do this, in the "Save As" dialog panel, click the "Options..." button. An additional dialog panel "Options" will appear (see Fig. 7.32).


Rice. 7.32. Options Dialog Bar

The Options dialog box contains several cards that specify various variables, parameters, and characteristics of the word processor environment and the document being prepared.

The "Save" card should be placed in the foreground. If another card is in the foreground, select the "Save" card by clicking on its title (bookmark).

The "Save" card contains many switches and editing fields, divided into two groups: "Save Options" and "File Sharing Options for Document1". Select the "Embed TrueType Fonts" switch in the "Save Options" group. Now, when you save a document, the TrueType fonts used in the document will be embedded in the file.

Click the "OK" button located on the "Save" card. The Options dialog box will close and you will be returned to the Save As panel. If you have entered the document file name and path correctly, click "OK". The document will be saved. In our example, the document is saved in the file DOC1.DOC, located in the WINUSER directory on the D: drive.

The document is ready. If you view it on a computer that does not have all the TrueType fonts used in the document installed, they will be temporarily connected (installed).

The ability to embed all the necessary TrueType fonts into a document makes the document more independent of the set of tools installed on the computer.

The only drawback of the technology of embedding fonts into a document is a slight increase in the size of the final file. If there is little free space on your computer's hard drive, perform the font embedding procedure when the document is already prepared and you are going to share it with other users.

While preparing your document, disable the "Embed TrueType Fonts" switch located in the "Save" card of the "Options" dialog panel. This procedure will allow you to save free space on your computer’s hard drive while preparing the document.

Introduction 3

1. Concept of OLE 4

2. Using OLE 7

2.1 Implementation 12

2.2 Drag and drop objects from one application to another 13

2.3 Linking objects 14

Conclusion 28

Literature 29


Introduction

With the advent of personal computers (PCs), a process of informatization of all types of human activity began: production, science, technology. This process is caused by the contradictions between a person’s limited abilities to perceive information and powerful flows of incoming and stored information.

The development of informatization of society is closely related to the development of computer technology.

When you turn on the PC, the operating system (OS) automatically starts working - a set of software that provides several types of interface, among which an important role belongs to the interface between different types of software.

Technology is used to link documents from different applications

For example, when preparing text in a word processor, there is often a need to place illustrations. For this purpose, a graphic file of a drawing can be used as an object for linking or embedding in a text document.


  1. Concept of OLE

OLE (Object Linking and Embedding) is a technology for linking and embedding objects into other documents and objects developed by Microsoft.

OLE allows you to transfer a piece of work from one editing program to another and return the results back. For example, a publishing system installed on a personal computer can send some text for processing to a word processor, or some image to an image editor using OLE technology.

The main advantage of using OLE (other than reducing file size) is that it allows you to create a master file, a file cabinet of functions that the program calls upon. This file can operate on data from the source program, which, after processing, is returned to the source document.

OLE is used in processing compound documents and can be used to transfer data between various unrelated systems via a drag-and-drop interface, as well as when performing operations with the clipboard. The idea of ​​embedding is widely used when working with multimedia content on web pages (example Web TV), which uses the transmission of images, sound, video, animation in HTML pages (hypertext markup language) or in other files that also use text markup (for example , XML and SGML). However, OLE technology uses a “thick client” architecture, that is, a networked PC with redundant computing resources. This means that the file type or program being attempted must be present on the client's machine. For example, if OLE operates on Microsoft Excel tables, then Excel must be installed on the user's machine.

OLE 1.0

OLE 1.0 was released in 1990, based on the DDE (Dynamic Data Exchange) technology used in earlier versions of the Microsoft Windows operating system. While DDE was very limited in the number and methods of transferring data between two running programs, OLE had the ability to handle active connections between two documents, or even embed a document of one type into a document of another type.

OLE servers and clients interact with system libraries using virtual function tables (VTBL). These tables contain pointers to functions that the system library can use to interact with the server or client. OLESVR.DLL (on the server) and OLECLI.DLL (on the client) were originally designed to communicate with each other using the WM_DDE_EXECUTE message provided by the operating system.

OLE 1.1 later evolved into the COM (component object model) architecture for working with software components. The COM architecture was later redesigned as DCOM.

When an OLE object is placed on the clipboard, it is saved in native Windows formats (such as bitmap or metafile) and is also saved in its own format. The native format allows an OLE-enabled program to embed a portion of another document copied to the clipboard and store it in the user's document.

OLE 2.0

The next evolutionary step was OLE 2.0, which retained the same goals and objectives as the previous version. But OLE 2.0 became an add-on to the COM architecture instead of using VTBL. New features include automation of drag-and-drop technology, in-place activation and structured storage.

ActiveX

In 1996, Microsoft renamed OLE 2.0 technology ActiveX. ActiveX controls, ActiveX documents and Active Scripting technology were introduced. This version of OLE is primarily used by web designers to insert multimedia data into pages.

To summarize, OLE is a set of tools that allows you to easily prepare documents that include data prepared in various applications. Before you can combine data prepared in different applications, those applications must support the technology OLE. Standard Applications Windows - Paintbrush, Write, Sound Recorder, Cardfile, Object Packager support OLE. In addition to standard Windows applications, many other applications developed by Microsoft and other third-party companies include support for OLE technology. Microsoft Word for Windows 2.0 and 6.0, Microsoft Excel 4.0 and 5.0, ZSoft PhotoFinish 2.0, Designer, FoxPro for Windows, Access and many other packages include support for OLE technology.


2. Using OLE

Object linking and embedding allows information from one application to be used in another. To use technology OLE Both the source application and the target application must support OLE.

Using object linking and embedding technology ( OLE ), implemented in Microsoft Windows, you can copy and place information from one application to another, while maintaining the ability to edit it in the original application.

Both linking and embedding insert information from one document into another. Further, in both cases, editing the object is performed in the document of the receiving application.

Linking is one of the methods of using data from a source document in a target document. Moreover, any changes to an object in the source document entail changes to this object in all other documents that use this object through communication.

Not all applications support technology OLE . Applications that create objects to transfer are called OLE -servers, which allow you to embed or link other people’s objects OLE clients.

OLE technology can be shown with a specific example of copying a drawing view of an AutoCAD application into a Microsoft Word document.

Open the AutoCAD application and select the drawing we need from the list of files (Fig. 1)

Fig.1.

In order to copy a drawing into the Microsoft Word text editor, click the Edit button on the toolbar (Fig. 2) and activate the Copy view line. Open a Microsoft Word document and paste the drawing into the desired place in the text.

Rice. 2

Fig.3

In order to edit a drawing in a Microsoft Word document (Fig. 3), you need to hover the cursor in the drawing field and double-click the left mouse button to enter the application server. This will open an AutoCAD window with the original drawing, in which you can make all the necessary changes (Fig. 4). After pressing the button Save The changes will also be saved in Microsoft Word. If you close the AutoCAD application without first saving the file, a window will appear with the question “Do you want to update Microsoft Word before closing the object?” (Fig.5). The updated drawing is shown in Fig. 6.

At its core, object injection and linking are similar to block insertion and external linking. When copying an object from a destination document to another application, the connection between the latter and the server document is maintained.

Rice. 4

Rice. 5

Rice. 6

When embedding using the OLE method, a copy of the embedded data is placed in the master document. This copy loses its connection to the original document. Embedded data in a master document can be edited by the application in which it was created; but the original document does not change. When embedding objects, no connection to the source file is maintained. Embedding should be used if modification of the source document when editing the composite document is undesirable.


Source document

Changed

Source document

Composite

the document has not been changed

Composite document

Rice. 7

2.1 Implementation

One of the methods of using data from a source document in a target document. Allows you to paste a copy of an object from one document into another without linking to the original document.

Data embedded in drawings is not updated when the source document is modified. Objects can be embedded in drawings by copying them to the clipboard and then pasting them into a file in another application. This way, for example, you can add a company logo created in another application to a drawing.

For OLE implementation -object to another application you need:

  1. Open the document in the original application.
  2. Copy the embedded data to the clipboard.
  3. Open another application.
  4. Click "Edit" and "Paste".
  5. Click "OK".

Rice. 8. Implementation of OLE -object from the application MathCAD to Excel

2.2 Drag and drop objects from one application to another

Data and graphics selected in another application window can be added to the drawing by dragging them across the screen. Both the window of the original application and the window of the other application must be open and not minimized (Fig. 9). Drag and drop between applications is only possible if the second application supports ActiveX technology. Objects moved in this way become embedded (rather than linked). Normally dragging and dropping data is similar to cutting and pasting data sequentially. The data is completely removed from the server document and inserted into the master document. If dragging is performed while pressing the key CTRL , instead of cutting, copying is carried out; a copy of the data is created in the compound document, while the original version remains unchanged.

Rice. 9. Drag and drop OLE object from MathCAD to Excel

2.3 Linking objects

When linking using the method OLE a link is created between the server document and the compound document. Linking is a convenient way to use the same data in different documents: if the source data is modified, only updating the links is required to change the constituent documents. Most receiver applications can also be configured to update them automatically.

When establishing a drawing link, you must maintain access to original application, and to the document. If any of them are renamed or moved, the link may need to be re-set.



Source document

Changed

Source document

Composite document

Changed

Composite document

Rice. 10

In Fig. Figure 11 shows copying an object from MathCAD to Excel in the mode of creating a link between the server document and the compound document. Using the usual method, we prepare the formula from MathCAD to copy, i.e. select the formula, right-click to call up the menu and activate the line Copy. Move the cursor to the desired place on the worksheet Excel and left-click. Right-click to open a menu in which we activate the lineSpecial insert(red arrow in the picture). In the windowSpecial insert(Fig. 12) press the button To tie and select the desired format (in the field How ). Press the button OK. Formula from the application MathCAD copied to the application Microsoft Excel with connection.

To edit an object in Excel you need to place the cursor on the object field and right-click to call up the menu (Fig. 13), click on the button Open and in the worksheet that appears MathCAD make the necessary changes to the source object. Automatically these changes are made to the worksheet object Excel (Fig. 14).

Copy

Rice. eleven

Rice. 12

Rice. 13

Rice. 14

If the application from which the object was transferred is not installed on the computer, then when you try to edit the inserted object in the document ( double click object) a window will appear with an error warning (Fig. 15) or (when calling the menu with the right button) - information about the unknown origin of the server object (Fig. 16).

Rice. 15

Rice. 16

If changes were made to the server document object while the compound document with the associated copy was closed, then when opening the file with the compound document, a window will appear warning you about updating or not updating the data (Fig. 17).

Rice. 17

Similar technology OLE with communication occurs when copying and editing objects, for example, from an application MathCAD in Microsoft Word (Fig. 18).

Rice. 18

Drag and drop is used to copy and move data, create related objects, shortcuts, and hyperlinks between documents different programs. Each program must support the protocol OLE.

In this case it is necessary:

1. Arrange the program windows so that both the source file and the destination file are open and visible. You need to see the data being dragged and where it will be placed.

2. Select the data, and then, while holding down the right mouse button, drag the selected data to a new location or to another program.

3. Select the desired command in the context menu.

In Fig. Figure 20 shows the result of dragging a formula from the application Excel to Microsoft Word.

Drag and drop

Rice. 19.

Rice. 20.

Drawing image in file Microsoft Word can be converted, for example, into an icon. The procedure should be as follows:

1. Call up the menu for editing the drawing, but instead of a button Edit ( Edit) press the button Convert (Fig. 21).

2. In the “Object type conversion” menu that appears, put a checkmark in the rectangle of the current type, press the buttons “As an icon” and OK (Fig. 22).

3. An icon will appear in the field where the drawing was (Fig. 23)

The procedures for editing a drawing converted to an icon remain the same as described above, but they are behind the scenes.

Rice. 21

Rice. 22

Rice. 23

In Fig. 24 shows an image of a drawing made using a program for designers Microsoft Office Visio and copied onto the document page Microsoft Word.

In order to change a drawing, you need to right-click on its field and in the menu that appears, activate the line “Object Visio " and click the "Change" button (Fig. 25). An editor window will appear Visio (Fig. 25), where you can use the corresponding figures on the toolbar to make the necessary adjustments to the drawing. For example, in Fig. Figure 26 shows the corrected drawing.

Rice. 24

Rice. 25

Rice. 26

Rice. 27

Let's show an example of inserting a diagram from the application Microsoft Gr a ph in Microsoft Word application . For this purpose they are used following operations:

  1. On the toolbar, click the button Insert + Object.
  2. In the “Insert object” window (Fig. 28), select the object type in our case “Diagram” Microsoft Gr a ph.”

Rice. 28

  1. Click OK . The work field opens Microsoft Gr a ph (Fig. 29).
  2. Using tools Microsoft Gr a ph build the desired diagram and left-click on the field outside the figure. The diagram is inserted into the document (Fig. 20).

Rice. 29

Rice. thirty

To edit the diagram, double-click in the object area and call it to make the necessary changes (Fig. 31).

Rice. 31

A similar procedure is used to insert formulas from the application. Microsoft Equation 3.0.

When you double-click on the formula, a toolbar will appear Microsoft Equation and you can make changes to the formula (Fig. 32):

Rice. 32

In Fig. Figure 33 shows a drawing made using the program COMPASS 3 D LT V 10 and copied to Microsoft Word.

To edit a drawing, just double-click on the object, thereby calling the server program, and make adjustments to the drawing (Fig. 34).

Rice. 32

Rice. 34

Conclusion

The course work shows that among a number of types of interfaces, the interface between different types of software (PC applications) plays an important role.

To link documents from different applications, such as AutoCAD, Microsoft Word, MathCAD, Microsoft Excel, Microsoft Power Point, Microsoft Equation, Microsoft Office Visio, Microsoft Graph , COMPASS, etc., technology is used OLE (Object Linking and Embedding ), which means “linking and embedding objects”.

The main possibilities are considered OLE technology, basic techniques for its use are given.

The presence of such a mechanism allows you to transfer a fragment or file of some application to the output document. The output linked document acquires the properties of a compound document, that is, a document that has built-in or linked objects of various formats created by other applications.

Basic usage OLE technologies are shown with specific examples.

The results of the work are presented in the form of a presentation Microsoft Power Point , which allows you to visually accompany a public speech using multimedia effects.

Literature

  1. Microsoft Office 2000: Directory. Ed. Yu. Kolesnikova. St. Petersburg: Peter, 1999. 480 p.
  2. Vlasenko S. Yu. Microsoft Word 2002. St. Petersburg: BHV Petersburg, 2002. 992 p.
  3. Dodge M., Stinson K. Effective work with Microsoft Excel 2000. St. Petersburg: Peter, 2002. 1056 p.
  4. Computer science. Basic course / Simonovich S.V., Evseev G.A., Murakhovsky V.I., Bobrovsky S.I. St. Petersburg: Peter, 2001. 640 p.
  5. Stolyarov A. M., Stolyarova E. S. Word 2002 for myself.M.: DMK Press, 2002. 432 p.
  6. Stotsky Yu. Self-teacher Office 2000 St. Petersburg: Peter, 2000. 608 p.

7. Shafrin Yu. A 1500 basic concepts, terms and practical tips for personal computer users. M.: Bustard, 2001. 272 ​​p.

You can use Object Linking and Embedding (OLE) to include content from other programs, such as Word or Excel.

The OLE interface is supported by many different programs and is used to place content created in one program into another program. For example, you can insert an Office Word document into an Office Excel workbook. To see what type of content you can insert, go to the Insert in Group Text select element An object. In field Object type only objects of programs installed on the this computer and supporting the OLE interface.

General information o Linked and embedded objects

Data that is copied into Excel from another OLE-enabled program (such as Word) can be pasted as a linked object or an embedded object. The main differences between embedded and linked objects are where the data is stored and how the object is updated after it is inserted into the target file. Embedded objects are stored in the workbook in which they are inserted and are not updated. Related objects remain in separate files and can be updated.

Linked and embedded objects in a document

1. The embedded object has no connection to the source file.

2. The linked object is linked to the source file.

3. When the source file is updated, the associated object is updated.

When to Use Linked Objects

Use linked objects when you want the data in the target file to be updated when the data in the source file changes.

When using a linked object, the original data is stored in the source file. The resulting file displays a view of the associated data, but only stores information about the location of the source data (and size, if the object is Microsoft chart Excel). To maintain a link to the original data, the file in which it is stored must be available on local disk or online.

Linked data can be updated automatically when data in the source file changes. For example, if you select a paragraph in a Word document and then insert it as a linked object in an Excel workbook, then when you change the data in the document Word data V Excel workbook will also be changed.

When to Use Embedded Objects

Use an embedded object if you don't want the copied data to change when it changes in the source file. The source data version is fully embedded in the workbook. When you copy data as an embedded object, the resulting file takes up more disk space than when you bind data.

When you open a file on another computer, you can view the embedded object without having access to the original data. Because the embedded object is not associated with the source file, it is not updated when the source data changes. To change an embedded object, double-click it to open and edit it in the original program. The source program (or another program that allows you to edit the object) must be installed on your computer.

Changing how an OLE object is displayed

In a workbook, a linked object or an embedded object can appear either as it appears in the original program or as an icon. If the book will be viewed online and will not need to be printed, you can choose to display this object as an icon. This reduces the area occupied by the object on the screen. To view this object in its original form, double-click its icon.

Embed an object on a sheet

Inserting a link to a file

Note:

Creating an object in Excel


Embed an object on a sheet

Inserting a link to a file

You can simply add a reference to the object rather than embedding it entirely. This can be done if the workbook and the object you want to add are stored on a shared SharePoint site network drive or the location and location of the files will not change. This is useful if the linked object changes, since the link is always opened latest version document.

Note: If the linked file is moved, the link will not work.

Creating an object in Excel

You can create a new object based on another program without leaving the book. For example, if you want to add more detailed description charts or tables, you can create an embedded document, for example Word file or PowerPoint to Excel. You can set to display the object to the right in the worksheet or add an icon that opens the file.


Link or embed content from another program using OLE

You can link or embed content (in whole or in part) from another program.

Embed content from another program

Linking or embedding Partial content from another program

Changing how an OLE object is displayed

    An object Object type(For example, Object Document) and select the command Convert.

    • To display the contents of an object, clear the checkbox As an icon.

      To display the icon, select the checkbox show as icon. You can change the default icon or label if necessary. To do this, click Change icon and click the icon you want from the list icon or in the field title enter a label.

Controlling Updates in Linked Objects

When establishing links with other programs, the update can be performed in one of the following ways: automatically when opening the target file, manually if you want to view previous data before updating it from the source file, or using an update request, regardless of whether the update method is enabled (automatic or manual) .

Installing an update manually in connection with another program

Setting up automatic communication updates with another program

Issue: Unable to update automatic links on a worksheet

Parameter Automatically in Excel it is overridden by the parameter Update links to other documents.

To ensure automatic OLE object links are updated automatically, do the following:

Immediate update of connection with the program

Changing content from an OLE program

IN Excel application You can change content that is linked or embedded from another program.

Editing a Linked Object in the Source Program

Editing an embedded object in the source program

    Double-click the embedded object to open it.

    Make the necessary changes.

    If you change an object while the program is open, click outside the object to return to the target file.

    If you are changing an object in the source program, open in a separate window, exit the source program to return to the target file.

Note: Double-clicking some embedded objects, such as video and audio clips, will play them instead of opening them. To edit such an embedded object, right-click the icon or object, hover over the element An object Object type(For example, Media Clip object), and then select the command Change.

Editing an embedded object in a program other than the source

    Select the embedded object that you want to change.

    Right-click an icon or object, hover over the element An object Object type(For example, Object Document) and select the command Convert.

    Perform one of the following actions.

    • To convert the embedded object to the type selected in the list, select the check box convert to.

      To open an embedded object in the format selected in the list without changing the type of embedded object, select the check box activate how.

Selecting an OLE object using the keyboard

    Press CTRL+G to display the dialog box Transition.

    Click the button Select, select an option objects and press the button OK.

    Press several times TAB key until the required object is selected.

    Press SHIFT+F10.

    Hover over an element An object or Diagram object and select a team Change.

Issue: When I double-click a linked or embedded object, the message "Cannot be edited" appears

This message appears when the source file or program cannot be opened.

Make sure the original program is available. If the original program is not installed on your computer, convert the object to the file format of the program that is on your computer.

Make sure you have enough memory. Make sure your computer has enough memory to run the original program. If necessary, close other programs to free up memory.

Close all dialog boxes. If the original program is running, make sure there are no open dialog boxes. Switch to the original program and close any open dialog boxes.

Close the source file. If the source file is a linked object, make sure that it is not open by another user.

Make sure the original file name has not changed. If the source file that you want to change is a linked object, make sure that it has the same name as when you created the link and that it has not been moved. To find out the name of the source file, select the associated object, and then on the tab Data in Group Connections select team Change connections. If the source file has been renamed or moved, use the button Change source in the dialog box Changing connections to find the original file and restore the connection.

additional information

You can always ask a question from the Excel Tech Community, ask for help in the Answers community, or suggest a new feature or improvement to the website

Introduction to OLE technology

The emergence of OLE technology is due to the need to generate documents from data different types. The main advantage of OLE technology, which was developed by Microsoft, is that it has no restrictions and allows you to organize data transfer between almost any application. OLE technology is determined by the rules (protocol) of interaction between Windows applications. The basic version of OLE technology was subsequently expanded to OLE 2.0, which is currently the most commonly used version.

Note. The abbreviation OLE stands for Object Linking and Embedding, which translates as object binding and embedding.

Not all Windows applications fully support OLE technology, but only those designed for developing compound documents. Some applications can only be used as a sink, others only as a source, but there are applications that can act in both roles.

For example, text WordPad editor fully ensures work using OLE technology, since it is designed for creating text documents that can contain pictures, sounds, tables, video clips, etc. The Paint graphic editor is designed for preparing simple drawings; it cannot work using OLE technology only as an application - source. The Word word processor is a complex complex and actually includes several applications: a picture editor, an equation editor, a text editor, etc. These applications use OLE technology in different ways. The formula editor acts only as a source application (OLE server), while the text editor can act as both a source and a sink (OLE client). You can view the list of OLE servers operating in the system by running the command Insert object(in Word, this command is included in the menu Insert).

OLE technology provides the user with the ability to edit an object inserted into a compound document using the tools provided by the source application. An OLE object always remains associated with the source application (this association is activated by double-clicking), but may not be associated with the source document.

OLE technology provides two options for data exchange:

§ implementation of the object, in which the object itself is inserted into the receiving document. An OLE object does not use the source application to display or print a document. For example, if you transfer a compound document to another computer, the OLE object will display normally even if that computer does not have a corresponding source application. However, the OLE object retains a connection to the source application, which allows the OLE object to be edited within the compound document;

§ object binding, in which not the object itself is placed in the destination document, but only a link to the source document. In this case, the OLE object will not be associated with the source application, but with the source document in which the object resides. This relationship allows you to change the representation of an object in the destination document as soon as that object is changed in the source document.

Injection of an object

When you embed an object, the object itself is inserted into the destination document. If this object was obtained by copying data from some source document, then the data is saved in the same place, and a copy of it is inserted into the destination document, and no connection is established between the object and its copy. At the same time, along with the team Insert you can use the command Special insert.

There are several ways to embed an object in a document:

§ from an open document (using the commands Insert And Special insert);

§ from a file (using a special command to insert a file or import a file);

§ directly calling the OLE server (with the command Insert object).

Embedding an object from an open document is done as follows:

§ in the source application, the object that will be implemented is allocated;

§ the selected object is copied to the clipboard using the command Copy or Cut out;

§ a transition is made to the receiving application, where a composite document is generated, and the mouse pointer is positioned at the place where the object is inserted;

§ an object is inserted using the command Insert or Special insert;

§ when using the command Special insert The “Insert Special” dialog box appears on the screen (Fig. 12.15), in which you need to select the method of inserting data as an object, and check the selection button<Вставить>and press the button<ОК>. Data can also be inserted into a master document in the form of an icon, for which you should select the corresponding radio button in the “Paste Special” dialog box.

The technology for embedding file content, which is discussed using the Word application as an example, is as follows:

§ command is entered File from the control menu Insert;

§ in the “Insert File” dialog box (Fig. 12.16), the necessary parameters are set and the file name is selected. In this case, you should not install the switch<Связь с файлом>so that the contents of the file are embedded;

§ press the button<ОК>.

Rice. 12.15. Paste Special window in Word

Rice. 12.16. Insert File Window in Word Processor

For other applications the technology is similar, the difference is in the specific command names.

The new object is inserted into the compound document as follows:

§ the place of implementation is indicated in the composite document;

§ command is entered Insert object(in the Word environment – ​​item An object control menu Insert);

§ in the “Insert Object” dialog box (Fig. 12.17), select the type of object to be embedded, i.e. source application. Checkbox<Связь с файлом>should not be installed in order for the object to be embedded;

§ button is pressed<ОК>;

§ a new object is created in the source application, which, after exiting the source application, will be inserted into the destination document.

Rice. 12.17. The Insert Object window in Word

An object embedded using OLE technology can be edited using the source application in the following ways:

§ select the appropriate command in the control or context menu;

§ Double-click the left mouse button on the embedded object.



Note that if the same object is embedded in several documents, then each document will store its own copy of the object. In this case, storing the object and all its copies requires additional expense external memory. In addition, no connection is maintained between copies of the object; changing one of the copies does not in any way affect the remaining copies of the object.

Rice. 12.18. Procedure for linking objects using OLE technology

Object binding

When you view or print a compound document, the linked object is no different from the embedded object. The difference only appears when editing the object. The associated object is always located in the source document, and the composite destination document stores a link (location) to the file with this document (Fig. 12.18).

Thus, when linking an object, references to the object are indicated in the destination documents, and the object itself is stored in a single copy in the source document. Any changes to an object made in the source document are necessarily reflected in the representation of the object in the composite documents. When opening a compound document, you must make sure that all the files in which the objects associated with it are stored are present, and in exactly the folders in which they were located when linking.

It is advisable to use the object linking technology in the following cases:

§ the object is inserted into several different documents, and it is necessary that any changes to this object are reflected in these documents;

§ the object takes up too much space and makes it difficult to work with a compound document;

§ in case of insufficient external memory.

There are two ways to create linked objects in a master document:

§ from an open document. In this case, only a certain fragment from the source document can be included in the composite document;

§ from file. In this case, the source document is completely included in the composite document.

Note! To link an object, the object must be saved in a file as a document or part of a document.

Linking an object from an open document is done as follows:

§ in the source application, the object that will be linked is selected;

§ the selected object is transferred to the clipboard using the command Copy;

§ a transition is made to the receiving application, in which a composite document is generated, and the mouse pointer is positioned at the place where the object is inserted;

§ command is entered Special insert;

§ In the Paste Special dialog box, the selection button is marked<Связать>, indicates the method of inserting the object (in in the usual form or as an icon) and press the button<ОК>.

Linking to a file (using the word processor Word as an example) is as follows:

§ the insertion location is indicated in the composite document;

§ command is entered File from the menu Insert;

§ in the Insert File dialog box (cm. rice. 12.16) the checkbox is checked<Связь с файлом>and other necessary parameters, then select the document in which the object is stored;

§ button is pressed<ОК>.

You can change a linked object by editing the source document in which it is located. This can be done in one of two ways. The first way is to open the source document directly in the source application environment, the second way is to open the source document from the master document where the related object is located. Opening can be done either using context menu, or by double-clicking the mouse button on this object.

Because related objects are stored separately from the master document in their source documents, it is important to have knowledge of the master document's relationships. You can view, update and change the links of a compound document in the “Links” dialog box, which, for example, in the Word application is called with the command Connections from the menu Edit(Fig. 12.19). This dialog box contains information about the relationships of this object:

§ file specification (path);

§ object type or format;

§ object update mode in a compound document – ​​automatic or manual (on request).

At automatic update the linked object in the master document changes as soon as it changes in the source document. At manual update requires explicit instruction from the user.

Rice. 12.19. The Links dialog box in Word