Mirror

How to map a variant OLEObject to an interface (Views: 100)


Problem/Question/Abstract:

There seems to be no way to map the variant OLEObject to an interface (in our case Word 2000) or even cast it so at design time.

Answer:

Yes there is. The OleContainer's OleObject property holds the document as an IDispatch, and you can just cast to the interface you want. For example:

{ ... }
Doc: _Document;
{ ... }

OleContainer1.CreateObjectFromFile(Path, False);
OleContainer1.DoVerb(ovShow);
Doc := IDispatch(OleContainer1.OleObject) as _Document;

<< Back to main page