15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Unwanted RTF headers in CRichEditDoc

acheal@mail.helix.net
Wednesday, October 02, 1996

Environment: NT 4.0, VC++ 4.1

In attempting to create a very simple MDI-based rich-text editor, I am
using a project derived from CRichEditDoc (and hence, CRichEditView), with
OLE container support. Whenever I attempt to "Save" entered text to a file,
the resulting file always ends up with a 3072 byte header on it, including
things such as "R O O T  E N T R Y". When I attempt to open this supposed
RTF file in WordPad or MS Word 7.0, the RTF information is not parsed
correctly (because of this header) and I end up with garbage. In looking at
"normal" RTF files generated by Word and WordPad, this header does not
exist, and the file begins immediately with the RTF formatting codes
"{\rtf1..etc...".

In comparing my simple generated code with that of the WordPad example, I
can find no significant difference in the Serialize procedure or anything
related to serializing the file, and have come up blank in the FAQ and
searches on the MSKB.

Anyone have any ideas as to how I can get my RTF files to save as true RTF
files? Or perhaps why my project generates this mysterious header, while
the WordPad example does not? Your thoughts are appreciated as I've hit a
wall with this one.

Adam Cheal
acheal@helix.net






Tony_Rentschler@ap.org
Saturday, October 05, 1996

[Mini-digest: 3 responses]

>In attempting to create a very simple MDI-based rich-text editor, I am
>using a project derived from CRichEditDoc (and hence, CRichEditView), with
>OLE container support. Whenever I attempt to "Save" entered text to a file,
>the resulting file always ends up with a 3072 byte header on it, including
>things such as "R O O T  E N T R Y". When I attempt to open this supposed
>RTF file in WordPad or MS Word 7.0, the RTF information is not parsed
>correctly (because of this header) and I end up with garbage. In looking at
>"normal" RTF files generated by Word and WordPad, this header does not
>exist, and the file begins immediately with the RTF formatting codes
."{\rtf1..etc...".

You probably had "use compound files" checked in the app wizard when
you built your project. You need to go through your source and remove
the compound file references, then you'll be able to write true rtf files.
-----From: Strhan Mojmir 

Would you be so kindly to switch-off compound document support and
to stop saving RTF to compound document stream?

Hope this helps.

Mojmir Strhan
strhan_m@simultan.ch


-----From: Mike Blaszczak 

This makes it sound like your document is saving itself as an OLE storage,
not as plain text.  Did you call EnableCompoundFile() at some point? 
Did something else call it for you?

.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |