Creating and displaying OLE documents in forms p.1. Electronic textbook for the course "Advanced training for managers, specialists and university teachers in the field of ICT"


Review

OLE Basics

TOLEContainer object

Example OLE application

Saving an OLE object in a database

  1. Review
  2. From the article you will learn basic information about OLE, some things regarding OLE 2 and OLE Automation. This article talks about using the TOLEContainer object to build an OLE application in Delphi.
  3. OLE Basics
  4. Before we get into the basics of OLE, we'll need to review some terminology.

    The acronym OLE stands for Objects Linked and Embedded J ). Data shared between applications is called OLE object. An application that can contain OLE objects is called OLE container (OLE Container). An application from which data can be included in an OLE container in the form OLE object ah, they callOLE server.

    For example, MicroSoft Word can include graphics, audio and video clips, and many other objects in a document (this document is sometimes called compound document ).

    As the name suggests, OLE objects can either be attached to or included in an OLE container. In the first case, the data will be stored in a file on disk, any application will have access to this data and will be able to make changes. In the second case, the data is included in the OLE container and only it will be able to view and modify this data.

    OLE is a further development of the idea of ​​data shared between applications. If using DDE it was possible to work with text, then OLE makes it easy to integrate processing of any type of data into an application. As with DDE, the client application (OLE container) requires an OLE server application to function properly. Every time a user accesses an OLE object in a client program to view or edit data (usually double-clicking on an object), the server application is launched, in which the data is processed.

    In nature, there are several types of OLE, differing in the way the OLE server is activated. OLE version 1 runs the server in separate window. OLE 2 implements what is calledin-place activation and editing. In this case, the server runs “inside” the client application, modifies the view system menu, line of tools, etc. The development of the OLE idea led to the emergenceOLE automation - the client application can execute part of the server code. The type of OLE object placed in the client program is determined by what version of OLE the server supports.

  5. TOLEContainer object
  6. The TOLEContainer object is located at page System Palettes Component and is needed to create OLE container applications. TOLEContainer hides all the complexities associated with the internal organization of OLE and provides the programmer with a fairly simple interface. Let's build a simple application with using OLE object. Create new project and place TOLEContainer on the form, in the Object Inspector, double-click on the ObjClass or ObjDoc property - the standard Windows “Insert Object” dialog will appear (see Fig. 1)

    This dialog contains a list of all OLE servers registered in the system (registration occurs during program installation). The type of OLE object is determined by the server you specify. If you create a new object (Create New), then when you click OK the OLE server program will start, in which the new object is created. After exiting the server program, the new OLE object turns on(embedded object) into the program. An OLE object can be created using an existing file in the format of one of the OLE servers. To do this, select Create from File (see Fig. 2)


    The selected object can be either included in the application or linked by checking the Link item.

    So, when creating our project, let's create a new object by choosing for this, for example, Microsoft Word Document (Fig. 1). Click OK and after MS Word starts, type any text there (“ This is an OLE object Microsoft Word document "). To complete the work, the menu has a special item “File|Close and Return to Form1” (Win’95+MS Word 7.0). Run the project, it will look something like this:

    Double-click on the OLE container - MS Word will launch with a document from the OLE object, which can be edited, and all changes are saved in the OLE object.

    If during design you select an object to include in an OLE container, then it is completely written into a form file (FORM1.DFM) and is subsequently compiled into an EXE file. In the case of very large objects, this can lead to long pauses during design and even an “Out of resource” error. Therefore, it is recommended to make large objects linked.

  7. Saving an OLE object in a database

Sometimes it is necessary to store OLE objects not in files, but in a database (BLOB field in a table). Of course, in in this case The OLE object must be embedded for portability purposes. Unfortunately, Delphi is not included in the standard distribution. special object type TDBOLEContainer for these purposes, but the OLE object can be saved and restored using the SaveToStream and LoadFromStream methods. For example:

procedure TOLEForm.SaveOLE(Sender: TObject);

BlSt: TBlobStream;

begin

With Table1 do

BlSt:=TBlobStream.Create(BlobField(FieldByName("OLE")),

bmReadWrite);

OLEContainer.SaveToStream(BlSt as TStream);

BlSt.Free;

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 various programs and is used to place content created in one program into another program. For example, you can insert Office document Word to book Office Excel. 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 being inserted into final file. Embedded objects are stored in the workbook in which they are inserted and are not updated. Linked 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 related data, but only stores information about the location of the source data (and size if the object is a chart Microsoft 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 in the 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 into the workbook. When copying data as an embedded object, the resulting file takes longer disk space than with data binding.

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 or 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.

Embedding an object on a sheet

Inserting a link to a file

Note:

Creating an object in Excel


Embedding 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 provide automatic update automatic links to OLE objects, 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 an object change occurs directly in the window open program, click outside the object to return to the destination 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 change such an embedded object, click right click mouse icon or object, hover over 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 the Tab key repeatedly until the item you want is highlighted.

    Press SHIFT+F10.

    Hover over an element An object or Object Diagram 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 original program and close all 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 to an Excel Tech Community specialist, ask for help in the Answers community, and also suggest new feature or improvement on the website

OLE technology

OLE- technology (Object Linking and Embedding– object linking and embedding) allows you to create complex compound documents that contain different types of objects created by different applications. So in Text Document Using the Word editor, you can insert an Excel table, a diagram that explains the text, or a mathematical formula; for the user it will remain a single document. The application responsible for the composite document is usually called a container. It has a complex structure, as it can work with “alien” objects. The application that created the object is called the server.

Containers and servers can support two modes of interaction:

    embedding (implementation) of objects. This mode means that the object data will be stored together with the main document (for example, embedded Excel spreadsheet will be saved in .doc - a Word editor file).

    linking objects. A master document stores only a reference to an object whose data resides in another document.

When embedding, the volume of stored documents increases, however, they are easier to move, while when linking, you must remember that changing the location of files can lead to erroneous links.

To edit related data, a separate window opens in the application in which this data was created, i.e. server. When implementing objects, you can also run the server in a separate window, but you can also edit the data “in Place”, i.e. in the container window, if it allows it. In this case, the container must have a menu, and the booted “in Place” server will supplement it with its own commands.

OLEContainer Component

On the System page of the component palette in Borland Builder C++ there is a special component designed for embedding and linking objects from other applications - OLEContainer.

Basic properties

Property State allows you to determine the state of an object and its server. Its meanings:

    osEmpty—the container does not contain an object;

    osLoaded – object in the container, the server is not running;

    osRunning – server is running;

    osOpen – OLE – object is opened in a separate server window;

    osInPlaceActive – the object is activated “in place”, but the menu has not yet been changed. This is the intermediate state of the object before the server is fully loaded.

    The osUIActive object is activated "in place", the menu is modified.

The following code allows you to define object name, loaded into the container (AnsiString property OleClassName), way of working with an object ( Linked= true – linking, otherwise – embedding), and also get the name of the linked document:

if (OleContainer1 -> State != osEmpty)

Label2 -> Caption = OleContainer1 -> OleClassName;

// Container state – an integer starting from 0 (osEmpty)

Label6 -> Caption = OleContainer1 -> State;

if (OleContainer1 -> Linked)

Label4 -> Caption = OleContainer1 -> SourceDoc;

bool property AllowInPlace defines the ability to edit an embedded object “in place”. If AllowInPlace = true and Iconic = false (the Iconic property determines whether the object should be represented as an icon), then “InPlace” – editing is allowed. When AllowInPlace = false, the server will open in a separate window.

Property AutoActivate has three possible values: aaManual, aaGetFocus, aaDoubleClick and determines how to activate the object loaded into the container.

Default AutoActivate = aaDoubleClick, that is, the object becomes active when double click. Meaning aaGetFocus defines activation when receiving input focus. When AutoActivate = aaManual The programmer is responsible for activating the object. In this case, you can use the container component's DoVerb method, which is responsible for passing commands from the container to the server. For example, you can use the following operator:

OleContainer1->DoVerb(ovShow); // Show object

In addition to sending commands to the server, container methods provide for the creation, loading and destruction of objects. Let's move on to consider them.

Creating and saving a new object (embedding)

Creation of a new object can be achieved using a special dialog box InsertObject(object insertion) or method call CreateObject. In the first case, the user selects the object class from the system list of possible objects, and in the second, a specific object is created programmatically.

To use the dialog box, you can use the following code, located, for example, in the “new” menu command:

AnsiString File_Name; // variable declared globally or in the form class

if (OleContainer1->InsertObjectDialog())

( File_Name = "";

OleContainer1->DoVerb(ovShow);

In the dialog box that appears, you need to set the value of the RadioButton button to “Create new”, select the required object type from the list and click “OK”.

An object can be created programmatically like this (operators can be inserted, for example, into the corresponding menu items):

    Excel spreadsheet

OleContainer1->CreateObject("Excel.sheet",false);

    Word document

OleContainer1->CreateObject("Word.Document",false);

If you need to create an object whose type name is unknown, then you need to either refer to the corresponding documentation for the server, or write a test program that loads the object using the method OleContainer->InsertObjectDialog() and use the OleContainer -> OleClassName property to determine its name.

When creating a new object, injection is used (since a file is needed for linking). In this case, the container program is responsible for storing the object data. You can save data to a file using the method SaveToFile (<имя файла>), for example, in the menu item “File - Save...” you can use the following code:

void __fastcall TForm1::FSaveClick(TObject *Sender)

( if (File_Name=="")

if (SaveDialog1->Execute())

File_Name = SaveDialog1->FileName;

OleContainer1->SaveToFile(ChangeFileExt(File_Name,"".ole"));

IN in this example The .ole file extension indicates that the object will be saved in a special format different from the server format. A server application separate from the container will not be able to read this data.

Function ChangeFileExt was used in the example to replace the file extension. When executing commands to save and retrieve data from a file, you may need other functions for processing file names:

    ChangeFileExt(const AnsiString FileName, const AnsiString Extension) – forcibly changes the file name FileName, replacing the extension with Extension;

    AnsiString function ExtractFileExt(AnsiString FileName) returns the file extension and therefore allows you to check its type;

    AnsiString ExtractFileName(AnsiString FileName) returns the file name extracted from the string FileName, i.e. after the last backslash or colon;

    AnsiString ExtractFilePath(AnsiString FileName)Retrieves the file path, including the last slash or colon;

    AnsiString ExtractFileDrive(AnsiString FileName) extracts the disk file with a colon (for example, "D:").

Container method LoadFromFile(<имя файла>) allows you to load a remembered object into a container:

void __fastcall TForm1::FOpenClick(TObject *Sender)

if (OpenDialog1->Execute())

if (ExtractFileExt(OpenDialog1->FileName)!= ".ole")

File_Name = OpenDialog1->FileName;

OleContainer1->LoadFromFile(File_Name);

OleContainer1->DoVerb(ovShow);

Creating an object from a file (embedding)

To create an object from an existing file, you can use the same window InsertObject, as in the case of creating a new object. In the case of embedding, the user sets the value of the RadioButton button to “Create from file”, and to search for a file clicks on the “Browse...” button.

A programmatic way to create an object from a file is provided by the method: OleContainer->CreateObjectFromFile(AnsiString<имя файла>,boolIconic).

The method parameters determine the name of the source file and the display mode of the object (Iconic=true – object in the form of an icon). This code can be inserted into the corresponding menu item:

void __fastcall TForm1::FFileClick(TObject *Sender)

if (OpenDialog1->Execute())

OleContainer1->CreateObjectFromFile(OpenDialog1->FileName,false);

OleContainer1->Repaint();

Method OleContainer->Repaint() causes the container window to be redrawn and, consequently, the object data to appear on the screen.

Creating a Linked Object

Just as with embedding, either the user or the programmer can create a related object.

To the user in the window Insert Object you should follow the file selection steps listed above and additionally select the “Communication” checkbox.

The programmer must use the method: OleContainer->CreateLinkToFile(AnsiString<имя файла>, bool Iconic).

Since when linking an object can only be edited in a separate window, the user can access the server menu to save the object.

Working with the server

Since only the program that created the object (server) can work with object data, the container may need knowledge about possible actions on the object. Method DoVerb(int Verb) requires the execution of one of the commands, and the entire list of possible actions contains the property ObjectVerbs container component. You can get this list only after loading the object into the container, and, naturally, each server (and, consequently, the object) has its own list of commands.

The ovShow constant is an example of a reserved OLE command. Using the DoVerb method with the movShow parameter, which was already discussed in one of the previous sections, leads to the immediate opening of the server.

The following code displays a list of possible commands for an object in the ListBox component (commands are numbered from zero) and asks to execute the second command in the list:

ListBox1->Items = OleContainer1->ObjectVerbs;

OleContainer1->DoVerb(1);

In addition, the container can ask the server to save the object data as a document in the server format. For this purpose the method is used SaveAsDocument(<имя файла>). This document can later be processed by the application server without the participation of the container. Interestingly, this method can be used for both linked and embedded objects.

When finished working with the object, the program can release the OleContainer by calling the method OleContainer->DestroyObject() - Destroy the loaded object. This method can be called before loading a new object or in the File-Exit menu command.

1. Create a new application. The main form contains the following components:

  • Multiple Label elements

And two non-visual components:

An approximate view of the main application window is shown in the figure. A picture (file with extension .bmp) is loaded into OleContainer. Server status: osRunning.

2. Add a component to the form that will display information about the object: “not loaded” / “embedding” / “binding”.

3. The menu should contain the following commands:

    "Object" (InsertDialog, new Excel object, new Paint object, embedded from file, embedded from "name PowerPoint presentations", linked from file, linked from "name Word document", Execute command);

    “Properties” (Object Properties, Server Commands);

    “Help” (About the program).

Ensure that menu items are only available at a time when the corresponding actions can be performed. For example, the item “Object”| "Run Command" can only be accessed if the object is loaded into an OleContainer and a ListBox is placed available commands server.

4. Create corresponding event handlers for all menu commands.

    "File" | “Load object” - the saved object is loaded from the ole file.

    "File" | “Break connection” - breaking the connection with the object;

    "File" | “Exit” - correct exit from the program (if there was a connection with the object, break it);

    "Object" | InsertDialog – the object and its method of loading into the container are selected in the dialog box by the user;

    "Object" | “Excel object” – a new object is created;

    "Object" | " Paint object» – a new object is created;

    "Object" | “Embedded from file” – the file name is determined by the user in the OpenDialog dialog box;

    "Object" | “Embedded from “PowerPoint Presentation Name” - a pre-created slide presentation is inserted into the container;

    "Object" | “Linked from file” - the file name is determined by the user in the OpenDialog dialog box;

    "Object" | “Linked from “Word document name” - a previously created document is inserted into the container;

    "Object" | “Execute command” - the command selected by the user in the ListBox$ is sent to the server for execution

    "Properties" | “Object properties” - the container requests from the server the name of the object, the state of the server and the name of the associated document, based on the information received, the conclusion is drawn: “the object is not loaded / embedded / linked.” The received information is displayed in the Label components of the main application window.

    "Properties" | “Server commands” - a list of server commands is displayed in the ListBox component;

    "Help" | “About the program...” - a window with information about the application and its author.

5. Conduct full testing of the application on various objects and servers.

OLE Object Library

An OLE object is any document generated using OLE technologies(Object Linking and Embedding). Many software applications running under Windows control, support this technology and generate documents that can be transferred to another software application as an object. Examples of such objects are: Painbrush drawing, WinWord document, work Excel sheet, Equation formula, picture Clip Gallery.

An OLE object library is a collection of all OLE objects created by you in the process of working with a specific NTZ. The OLE Object Library is accessed from the main window of the Test Designer or in MTZ by clicking the "Add object" or "Insert object" command button.

During one session of accessing the OLE Library, you can create or change several objects. In the future, when creating test tasks, you will only have to select the desired object as an element of the task.

The OLE Object Library interface provides:

  • Viewing OLE objects;
  • Input of a new OLE object;
  • Deleting an OLE object;
  • Modification of an OLE object;
  • Copying an OLE object;
  • Go to a specific OLE object;
  • Changing the display form of an OLE object;
  • Displays instructions for working with the OLE Object Library.

When the OLE Object Library is activated (carried out in MTZ when executing the “Insert Object” function), a window opens (Fig. 3), consisting of a viewing field, a functional menu and an OLE object list indicator.

List indicator

The list indicator displays the total number of OLE objects serial number presented in the viewing field of the object and its unique identification number (consists of an OLE hyphen and a number enclosed in braces). The object identification number is generated automatically and is not changed or reassigned even if the object that owns it is deleted. Using the list indicator, you can perform the following operations: move to the beginning of the list, move to the previous object in the list, move to the end of the list, move to the next object in the list.

The view field (also called an "OLE container") is designed to display the selected object. When entering the OLE Object Library from the main Test Designer window, the first element from the list is selected, and when entering from the Test Item Wizard, the selected item is:

  • When entering a new element of technical specifications - the first from the list of objects;
  • When modifying a TK element, the object displayed in the TK viewing window.

When in the OLE library environment, you can select an object in two ways:

By pressing the control buttons of the list indicator

By executing the menu command "Object / Go to ..." and specifying unique number OLE object in the library list. For example, to select the object shown in the figure, you must enter the value 25.

The selected element is called active.

Formation of the Library

Let's say you have the content of test tasks provided to you by the author.

You can enter test tasks sequentially, creating objects as needed.

Previously, before entering test tasks, the Library is filled with objects that can later be used as elements of test tasks.

Both of the above methods are used simultaneously. Some objects are created directly during the generation of tasks, others are created outside the Test Task Wizard.

After the final formation of the Test Task Accumulator, delete unused objects in the NTZ diagnostic mode. “Extra” objects increase the size of the NTZ database.

Creating a new object is possible in two ways:

First way

To create a new object, you must select the menu command "Object \ New", which opens the "Insert Object" window, where you need to set the switch "Create new \ Create from file" to the position you need.

By selecting the "Create from file" radio button, you can specify the file name in one of the following ways:

  • write in the window that appears next to the full path of the file with the desired object
  • press the Browse button, this will activate the standard Windows window to select a file.
  • until you have completed the conversion, the selected file should not change its location;
  • any changes to the file will result in automatic change and in the OLE object (when it is activated).

Click OK. At successful implementation the object you select is displayed in the OLE Object Library view window.

Execute the menu command "Return" or double-click the left mouse button on the object display.

Note. If you use linked objects, then you need to ensure that the files do not change their location until the NTZ is converted into an asq file. After conversion, the connection with the object is not tracked by the system. If you have chosen the technology of using linked files (which is advisable in some cases), we recommend that you keep all such files in a separate directory. When transferring the NTZ (file with the ast extension) to another computer, do not forget to transfer this directory as well.

When you select the “Create new” switch, a window appears with a list of software applications that are registered on this computer in the \Windows\System or System32 directory.

Select the application in which the new object will be created. Click OK.

The selected software application in which you create the object will load.

After leaving software application You are returned to the OLE library window. Execute the menu command "Return" or double-click the left mouse button on the object display.

The object you created should be displayed in the viewing field. No image means that the software application you selected does not allow you to embed the object. The reasons may vary. A consistent repetition of this situation with a specific software application means that this application cannot be used to create an OLE object. In some cases, you should consult with system programmer, since the reasons for incorrect processing of OLE objects may be due to malfunctions operating system and applications, the settings of the applications themselves.

If nothing worked with inserting an object (unfortunately, not every object can be inserted), you will know about this in the blank viewing field (OLE container). You don't have to worry about empty or unused OLE library objects. They can be deleted at any time.

Second way

Select an object from the OLE Library that is closest to the image and copy it. The copy of the object you created is displayed in the viewing field and the indicator pointer is set to the number of the newly created object by copying.

Select the "Change" command. The software application is activated, in the environment of which you bring the image of the object to the one you need.

After exiting the software application, you are returned to the OLE Library window. Execute the menu command "Return" or double-click the left mouse button on the object display.

Comment. You can reduce the number of operations by using the Copy and Modify command.

Viewing objects

Sequential viewing of all objects is carried out by pressing the control buttons of the list indicator. This changes the contents of the viewing field.

Selective viewing of an object is possible by executing the menu command "Object / Go to". You need to enter the unique identification number of the object without the hyphen "OLE-", i.e. numeric value only, displayed in curly braces.

The number of the object displayed at a particular time is indicated on the list indicator.

Modifying an existing object

Check that the object you want to change is displayed in the viewport. If necessary, follow the steps to ensure that you select the object you need.

Execute the menu command "Object / Edit" or double-click the left mouse button on the object display. The editor in which the selected object was created opens. Make the necessary changes; the order of actions is determined by the editing environment. When you finish editing, you need to exit the editor (for example, Word), remembering to save the changes. After closing the editor, you return to the OLE Object Libraries window. Only the Return menu command is available.

Execute the menu command Return or double-click the left mouse button on the object display.

Ole technology allows you to import objects from other applications while maintaining connections. Moreover, if you insert an image from an application such as Word or a graph from Excel, it will be saved in the file as an embedded object, i.e. when transferring a drawing, you do not need to archive it with the drawing, as is necessary to do when using external links in AutoCAD.

On the Insert tab there is the AutoCAD Ole Object command.

After activating the command, the “Insert Object” dialog box appears.

Here you can create new file. In this case, you should indicate the application (Photoshop, Microsoft Excel, Word, Power Point, etc.) in which you will work, and, subsequently, place your object in AutoCAD or immediately work based on existing file. In practice, the second option is used much more often. Let's look at it in more detail.

In the "Insert Object" dialog box, check the "Create from file" checkbox, and then click the "Browse" button to select the appropriate file. After these steps, the path to your document is written.

There are two insert options:

1) Independent – ​​after inserting an object, it is “stationarily” stored in AutoCAD. And when you change the source file, no changes occur in your drawing.

2) Linking files - in this case, their location on the computer should remain unchanged. If the path changes, the connection will be lost. Therefore, it is best to store these files in one folder. To link AutoCAD files, check the “Link” checkbox in the “Insert Objects” dialog box(Fig. 3).

Rice. 3 – Working with AutoCAD ole object based on an existing file.

After clicking OK, your ole object is inserted into the AutoCAD workspace. Now you can work with it as with ordinary AutoCAD primitives, for example, use editing commands.

Rice. 4 – AutoCAD Ole object in the form of a picture from Word.

If you double-click on such an ole object, the application in which it was originally created (or stored) will open. In this example, a regular picture from Word was inserted.

Rice. 5 – Availability feedback allows you to open the source application (in this case Word).

Implementation of Ole in AutoCAD via the clipboard.

Ole AutoCAD: secrets and tricks.

In this course on practical examples Work with Ole-objects of AutoCoad is considered. The video format talks about:

Print quality settings for ole objects;

How to remove the frame that frames these objects by default;

System variables when working with ole AutoCAD;

Reverse process of inserting ole objects from AutoCAD into third-party applications.

Well, as you can see, ole objects in AutoCAD are a very useful technology! And most importantly, using this principle allows you to answer the question: “How to insert a picture into AutoCAD without a link?” Now you can safely embed your company’s logo on drawings or project backgrounds and not be afraid that other users will not display these graphic objects.







2024 gtavrl.ru.