Object Linking and Embedding (OLE)

advertisement
Object Linking and Embedding (OLE)
In Windows, data (or "objects") from one program can be used in another.
For example, you can create a graph in Excel, and include it in a Word
document. This can happen in two ways:
Embedding
If you Copy an object from one program and Paste it into another, it gets
embedded. For example, if you copy a graph from Excel and paste it into
Word, then that graph becomes part of your Word document. If you change
the Excel spreadsheet that graph is from, the graph in Word doesn't change.
Also, because the graph is stored inside the Word document, it makes the
Word document larger (i.e. the file takes up more space).
Linking
Using Copy and then Paste Special it is possible to link an object. For
example, if you link a graph in an Excel spreadsheet to a Word document, the
graph is not stored in the Word file. A link is created so that if the graph or the
spreadsheet changes, the Word document is updated too.
Example
Here's how you to link and embed a graph from Excel into a Word document,
so that you can see the difference between the two techniques.
1.
Start Excel. Create a simple spreadsheet like
the one on the right. You can enter the
information very quickly as follows:
a)
Type Sunday in cell A1, and replicate by
dragging the cell down to A7
b)
Type =int(rand()*10) into cell B1, and
replicate the formula by dragging it down
to cell B7. The rand()*10 function creates
a random number from 0 to 10. The int()
function rounds a value to the nearest
whole number (integer).
A
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
B
9
3
4
6
5
3
3
2.
Highlight the range A1:B7 and create a graph using the
button.
3.
Without closing Excel, start Word. Arrange the Word and Excel windows
so that you can see both at the same time.
4.
Click on the graph in Excel, and select Copy from the Edit menu.
5.
In Word, go to the Edit menu and select Paste Special. The window
shown below will appear:
6.
Make sure you have selected "Paste link:" and click OK.
7.
Your graph will appear in Word, and should be exactly the same as the
one in Excel. This graph is linked to the one in Excel.
8.
Click somewhere on the background in Word so that the graph isn't
highlighted, and then select Paste from the Edit menu. A second copy of
the graph will appear in Word. It will look the same, but it is embedded.
9.
In Excel, the F9 key can be used to recalculate values in the
spreadsheet. Press the F9 key a few times; the values in column B and
the graph in Excel will change. Notice that the first graph you inserted in
Word also changes, but not the second one, i.e.:

The linked object (inserted using Paste Special) is updated

The embedded object (inserted using Paste) is not updated
Dynamic Data Exchange (DDE)
The technique of linking two files so that changes in one are reflected in the
other is also known as Dynamic Data Exchange, or DDE.
It is a useful technique because it allows you to do things with your data that
one program on its own might not be able to do. For example, you can use a
spreadsheet to plot graphs of information from a database or CAD program.
Download