How could I connect a Word document created on a OleContainer with this
exppresion:
olecontainer1.createobject('Word.document',false);
To a WordDocument Object.
I always have to use an Olevariant object to do some of the capabilities of
the document, but the problem is when i try to create the doc with the
WordDocument object an then i try to view the document in the ole container.
Thanks in advance.
H. Romero
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;
--
Deborah Pate (TeamB) http://delphi-jedi.org
TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html
olecontainer1.createobject('Word.document',false);
To a WordDocument Object.
>>
If you mean to a TWordDocument component:
WordDocument1.ConnectTo(
IDispatch(OleContainer1.OleObject) as _Document);
However it's probably not a good idea to have two
components fighting for ownership of a single document. You
can use an interface variable, as shown in my answer to
James, to get the benefits of early binding with less
overhead than the TWordDocument component.
"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.0000178...@blueyonder.co.not-this-bit.uk...
> <<James E Presley: