RTFOptions and Compatibility

General TRichView support forum. Please post your questions here
Post Reply
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

RTFOptions and Compatibility

Post by Michel »

Hi Sergey,

I am trying to achieve maximum compatibility of exported RTF.
RTFOptions default to: rvrtfDuplicateUnicode + rvrtfSaveEMFAsWMF + rvrtfSaveJpegAsJpeg.
If I export a document with all kinds of formatting and pictures (BMP and JPEG) using the above setting, Win2k WordPad loses the JPEG pictures (Word 97 is fine though).

I have experimented with all possible RTFOptions combinations (except for rvrtfSaveStyleSheet that I left out as per your recommendation in the Help). I discovered that the following combination (actually, just a single flag) produces RTF files that are "good". By "good" I mean that WordPad displays the JPEG picture, and that picture looks nice and smooth (as opposed to ugly and pixelated as what I got with a single rvrtfSaveEMFDefault option included). So, here's the "good" value: rvrtfSaveBitmapDefault.

These 2 flags were "bad" in my experiments (they were either preventing WordPad from seeing the JPEG picture or making it pixelated):
rvrtfSaveJpegAsJpeg, rvrtfSaveEMFDefault

These 2 flags didn't seem to make any difference in my tests. I must note that my RichView document is totally non-Unicode.
rvrtfDuplicateUnicode, rvrtfSaveEMFAsWMF

So, finally :) here's my question: what set of RTFOptions would produce the most compatible RTF document that should cause the least problems for mainstream RTF-aware applications?

WordPad seems perfectly happy with any of the following (since the last 2 flags don't seem to make any difference):
rvrtfSaveBitmapDefault
rvrtfSaveBitmapDefault + rvrtfDuplicateUnicode
rvrtfSaveBitmapDefault + rvrtfSaveEMFAsWMF
rvrtfSaveBitmapDefault + rvrtfDuplicateUnicode + rvrtfSaveEMFAsWMF

What application or what RichView Item could suffer from which ones of the above? I mean, I don't know much about EMF and WMF. What sort of stuff should I have in a RV document that rvrtfSaveEMFAsWMF flag would even make a difference? Well, I guess you get the idea of what I'm worried about...

Thank you in advance,

Michel
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, options and how they affect compatibility:

rvrtfSaveStyleSheet - saves style sheet made of styles having Standard property = True (older versions of TRichView made style sheet of all styles). Does not affect compatibility. This style sheet is used by MS Word and ignored by WordPad and TRichView.

rvrtfDuplicateUnicode - for Unicode characters, saves both Unicode characters and their ANSI equivalent. Increases file size, increases compatibility (can be read by readers not supporting Unicode)

rvrtfSaveEMFAsWMF - saves EMF (TMetafile with Enhanced property = True) as WMF. Increases compatibility, can lose some EMF features.

rvrtfSaveJpegAsJpeg - saves JPEG and JPEG. Decreases compatibility, decreases file size.

rvrtfSaveBitmapDefault - affects saving nonstandard formats, such as TIcon, of TJpegImage (if jpegs are not saved as jpegs). Not sure about compatibility: some RTF readers may not understand bitmaps, some may not understand metafiles of MM_TEXT mapping mode.

rvrtfSaveEMFDefault - decreases compatibility.
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

Fantastic! This is precisely the kind of info I was asking for! Thank you very much. (I'd cut-and-paste it straight into the next version of RichView Help (which is BTW already excellent) if I were you).

Just a mini-followup question. If my RV doc is ANSI-only (no Unicode at all), including rvrtfDuplicateUnicode results in a single change in the exported RTF file: \uc1 instead of \uc0. For a non-Unicode RV/RTF, is there any difference? Should I include it or shouldn't I?

Thanks once again, Sergey!

Michel
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

\uc specifies how many characters after each Unicode character must be treated as ANSI equivalent of this character.

\uc0 means - there will be no ANSI equivalents.
\uc1 means - 1 character after each Unicode character is its non-Unicode copy (and must be ignored by RTF readers which understand Unicode).

If the document has no Unicode characters, this option affects nothing.
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

Got it. Thanks!

Michel
Post Reply