Syntax 3 For data in an OLE server
Description
Gets data from the OLE server associated with an OLE control
using Uniform Data Transfer.
Controls
OLE controls and OLE custom controls
Syntax
|
1 |
<span>olename</span>.<span>GetData</span> ( <span>clipboardformat</span>, <span>data</span> ) |
|
Argument |
Description |
|---|---|
|
olename |
The name of the OLE or custom control |
|
clipboardformat |
The format for the data. You can specify Values for clipboardformat are:
If clipboardformat is an empty string |
|
data |
A string or blob variable that will contain |
Return Values
Integer. Returns 0 if it succeeds and
-1 if an error occurs.
Usage
GetData will return an error if you specify
a clipboard format that the OLE server does not support. To find
out what formats it supports, see the documentation for the OLE
server.
GetData operates via Uniform Data Transfer,
a mechanism defined by Microsoft for exchanging data with container
applications. PowerBuilder enables data transfer via a global handle.
The OLE server must also support data transfer via a global handle.
If it does not, you cannot transfer data to or from that server.
Examples
After the user has activated a Microsoft Word document
and edited its contents, this example gets the contents from the
OLE control ole_word6 and stores the contents
in the string ls_oledata. The contents
of the string are then displayed in the MultiLineEdit mle_text:
|
1 |
string ls_oledata |
|
1 |
integer li_rtn |
|
1 |
|
1 |
li_rtn = ole_word6.<span>GetData</span>( & |
|
1 |
ClipFormatText!, ls_oledata) |
|
1 |
mle_text.Text = ls_oledata |
One OLE control displays a Microsoft Word document
containing a table of data. This example gets the data in the report
and assigns it to a graph in a second OLE control. Microsoft Graph
in the second control interprets the first row in the table as headings,
and subsequent rows as categories or series, depending on the settings
on the Data menu:
|
1 |
string ls_data |
|
1 |
integer li_rtn |
|
1 |
|
1 |
li_rtn = ole_word.<span>GetData</span>(ClipFormatText!, ls_data) |
|
1 |
IF li_rtn <> 1 THEN RETURN |
|
1 |
|
1 |
li_rtn = ole_graph.SetData(ClipFormatText!, ls_data) |