RTF I/O (with images)

I was searching the Cocoa code to do that on OS X yesterday and I found one set here.

My next move was to use a #If Target and check that.

In my memory, I recall Xojo (Real Studio ?) on Windows knows how to open / save rtf “natively”. I even recall images…

So, I fired LibreOffice, copy / paste data (text + images) and saved it in a rtf file (suffixed lo as flag).

Then I fired in the IDE on Windows 10 the project and tried to get the whole rtf contents (styled text + images). I did get the styled text, but not the images.

a. LibreOffice saved a wrong rtf file…
b. Xojo 2015r1/2016r1 have been changed and do not use Windows API to deal with rtf,
c. I’ve made a mistake writing the code (in fact, copy/paste code from LR).

So, I ask here, in the Windows channel more knoledgeable people about their experience with Windows.

All in all, it seems that I must have two sets of rtf data:
a. rtfd files with images for OS X,
b. rtf files with images for Windows

(and I do not know the Linux situation).

As far as I know images are not supported and never were.
FTC by Bob Keeney does support them I think, but the standard Xojo RTF methods don’t support images.

On Windows ?

not on Windows and not on any other OS either. At least as far as I know. Others may correct me if I’m wrong.
FTC is the only option here as far as I know. I’m pretty sure it at least partially supports images. It might not support text flow around images.

Well I don’t really know anything about .rtf, but using Wordpad you can embed images, which seem to be saved within the .rtf file.


The file with image will load in the RTF Activex control, but I have no idea how to load in a new image.
( Blundering about in the dark as ever ). :wink:

The RTF Spec would be the definitive way to know if they are supported.

Hi all,

thanks for your answers.

Concerning the use of RTF files with images (and far more than that) OS X:

Xojo is not able - in its native form - to display rtf with images.

BUT WITH DECLARES, this is perfectly possible; in fact I use code shared here to do so:

a. create an rtf file with images (say: use TextEdit, place images there and save the result using the default rtfd file format,

b. place code to load the rtfd files (from either this list or CarbonLib) in a button,

c. Click in the button and enjoy your nice document in a TextArea (with colored columns, nice images, etc.).

At last, the reason why I started this conversation was to know how to do the same with Windows (and eventually for Linux).

No takers ?

PS: you can also paste styled text into a TextArea and watch how nice it can be; however that styled text can loose styles at save time.

Go there: http://deepwoods.org/mandrake_daily.html

a. copy some lines of the list of stories table (or the whole document),
b. paste it into a Xojo’s TextArea
c. enjoy what you get !

Background color is lost, but not the links, not the list…

Tested by yours truly with Xojo 2016r1, free version, in the IDE.
Not saved / saved file not Opened / OS X 10.11.4.

Did you try TextArea.WinRTFDataMBS?
This one may work with images.

Thank you Christian.