Page 1 of 1

Need support for the objattph tag in the RTF Reader

Posted: Sat Oct 22, 2005 7:54 pm
by Rob
I need support for this tag, which is used by Microsoft when Word is used as email editor.

The object is discussed in here:
http://www.biblioscape.com/rtf15_spec.htm
http://www.tech-archive.net/Archive/Dev ... /0232.html
http://groups.google.com/group/microsof ... 8b84af2db5

To cut things short, a description of this tag.
The tag is used in this manner:

Code: Select all

\objattph\'20
The tag defines a placeholder for image data. The actual image is not saved in the document, but the image is requested when this tag is found. Everytime the tag is encountered, the event to ask for the image needs to be fired with an index number. This index number is the Nth-1 time the event is called, so the first time this is 0, the second time this is 1 and so on.
The event then fills a stream provided in the event handler with the data from the attachment.

Sample document:

Code: Select all

{\rtf1\ansi\ansicpg1252\deff0\deftab360{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Riched20 5.40.11.2212;}\viewkind4\uc1\pard\lang1043\f0\fs20 This is a test with an \objattph\'20image. \par
Very cool stuff indeed\par
\par
\par
And this is an \lang1033\objattph\'20embedded document\par
}

Posted: Mon Oct 24, 2005 8:42 am
by Sergey Tkachenko
Is it always an image?

If yes, I can add an event to RichView.RTFReadProperties :

OnReadAttachment(Sender: TCustomRichView; Index: Integer; var Graphic: TGraphic);

Posted: Mon Oct 24, 2005 11:32 am
by Rob
YES. This ia ALWAYS an image, by design.

BUT.... It does not read an actual attachment. The idea is that the event implementor provides an image for the placeholder. This was, the actual image is not saved into the document.

The event should be OnGetAttachmentPlaceholderGraphic, with the same parameters.

The implementor can return the actual image, if this is feasible, or an icon for a Word-document attachment for example.

Posted: Mon Oct 24, 2005 5:25 pm
by Sergey Tkachenko
Should it be inserted as a hyperlink?

Posted: Mon Oct 24, 2005 5:46 pm
by Rob
No. It should be inserted as an image. The event returns a graphic that represents the attachment.

Word docs will be displayed with a word-document icon, and JPG images will be displayed as a thumbnail for example.

The implementor of the event should return this image thumbnail.

The strange thing about this tag is that it is actually nothing at all. It defines a placeholder for an attachment. The actual attachment is not saved.