Page 3 of 3

Posted: Mon Jan 19, 2009 7:22 am
by Blue
srod wrote:Update : 18th Jan 2009.

Problems with Wordpad recognising rtf with an embedded EMF [...]

@Blue : this should fix your problem.
I hadn't tried the result of the original code with MSWord, not realizing that there would be a difference with Wordpad.

I'll use the updated code, but, before anything else, i'll try the old test.rtf with MSWord. Just to see.

Many thanks for the attention, srod. Much appreciated. I was beginning to feel embarassed, seeing how everybody else was getting results :oops:


-----------------------------------------------------------
Feedback:
Using the first version of your code, i could see, when opening the RTF with Word, that the pic had indeed been embedded.
Plus it also worked with WordPad after re-saving the file from within Word.

-----------------------------------------------------------
Feedback 2:
just tested the updated code. Impeccable.
And you weren't kidding when you announced speed improvement: from snail pace to Mach-1 in one version change. Very impressive. :shock:

Posted: Mon Jan 19, 2009 11:00 am
by srod
Yes, rtf 'readers' (of which the RichEdit control is one) are free to ignore data streams that they cannot be bothered to support. It would seem that EnhancedMetaFiles and png files are examples of such streams that the basic RichEdit control (and thus WordPad) simply ignore. Perhaps the latest versions of the RichEdit control rectify this, but I haven't tested?

In the case you outlined when saving the rtf from MS Word and then viewing in WordPad, MS Word is kind enough to embed images in multiple formats; one of which is a basic MetaFile (not an enhanced one) which most readers are fine with.

Re:

Posted: Sat Sep 25, 2010 11:53 am
by PB
I noticed I can drag-and-drop a zip file into a WordPad document.
So, is there a way to maybe embed a zip file into a WordPad doc
like you've done with images? Or embed any type of binary file?

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:12 pm
by srod
Yes you can do it with editor gadgets (if that is what you are after) using, for example, my OLE 'images in editor gadgets' utility. It does require some alterations, however, following adjustments made by Nico. The code is a real mess now.

I can e-mail it to you if you want it?

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:21 pm
by PB
I was hoping to use it to create a standalone RTF document,
like this bmp2rtf does, rather than just into an EditorGadget.
If it can, then yeah, I'll PM you for it. Thanks!

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:29 pm
by srod
Sorry I misunderstood. I was referring to an ability to embed any binary file into an editor gadget through drag and drop as opposed to creating an rtf file in which a zip file is embedded etc.

What you are after would surely be possible, but you would have to study the rtf specs to see how to embed such a file. The rtf header would be the all important factor.

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:35 pm
by PB
No worries. I'm going to embed 2 different (but small) binaries to
two WordPad docs and then study the results with a hex editor. :)

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:39 pm
by srod
You don't need a hex editor. rtf is a 7-bit Ascii encoding. Just load the rtf file into notepad.

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:42 pm
by PB
So I can create a RTF doc using CreateFile and WriteString? :shock:

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 12:47 pm
by srod
That's what I do in my code in the first post of this thread.

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 1:03 pm
by srod
http://latex2rtf.sourceforge.net/RTF-Spec-1.0.txt

Scroll down to the OBJECTS section.

Re: Convert any bitmap to an RTF (rich text) string

Posted: Sat Sep 25, 2010 1:17 pm
by PB
> That's what I do in my code in the first post of this thread

:oops: I didn't look at your code too deeply (just skimmed it).

Re: Convert any bitmap to an RTF (rich text) string

Posted: Thu Aug 04, 2011 6:33 am
by ts-soft
Is there a way to add alpha-support?

Greetings - Thomas

Re: Convert any bitmap to an RTF (rich text) string

Posted: Thu Aug 18, 2011 6:39 pm
by Zach
I don't think you'll get an answer, you necro'd a 1 year old thread and s-rod is gone now I believe :idea: