Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: RichText files and OleSaveToStream format

464 views
Skip to first unread message

John

unread,
May 12, 1998, 3:00:00 AM5/12/98
to

How do I load an embedded object from an RTF file? The only method I've
been able to use forces me to use the entire CRichEdit set of classes... I
know it's possible, but have found absolutely no documentation on the
subject.

Thanks for any help!

Jo...@REMOVETHISenrnews.com

rgr...@yahoo.com

unread,
May 18, 1998, 3:00:00 AM5/18/98
to

In article <01bd7dc4$a8c1ff30$d201a8c0@johns>,

I'm beginner in OLE, so all that You'll read there may be outrageous lie :)

I don't know, why RTF documentation refers to the OleSaveToStream function
only. There's many other ways to save Ole and load object ( I think they all
implement the same internal function ). In the RTF file object is stored in
the root storage of COM storage. So, If You want to read OLE object from
RTF with MS Visual C, do the following:

1 Implement COleDocument and COleClientItem classes
2 open and read RTF file until You found *\objdata tag. object data is stored
in text hex format, ie each OLE data byte is represented by 2 bytes. Reject
first line, till sequence d0 cf 11 e0 ..... Output to a new file all bytes
including d0 cf 11 e0 till "}" character. (You will need to ignore carriage
return 0D 0A pairs).
3 Use StgOpenStorage function to get pointer to a new storage - new file
You created
4 Use OleLoad with pointer to opened storage to load object

Btw, when You generate separate file with extracted OLE data, You can view
its contents using utility DfView - structured storage viewer, it comes with
VC.

Any comments accepted

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

0 new messages