Saving StyledText.RTFData


I am using this code to save Styled Text in a MultiLine Styled TextArea, it is fast enough when there is a small amount of text but for larger amounts of text the time taken could be minutes.

If Document <> Nil then
'Document.SaveStyledEditField RxPadefBuffer 'This is the saved data
Dim TOS As TextOutputStream
TOS = TextOutputStream.Create(Document)
TOS = nil
End if

Is there another way to do this more efficiently?



I would use BinaryStream, but otherwise this is fine.

Optionally you can use TextArea1.StyledText.RTFDataMBS function in MBS Xojo Plugins.
For MacOS see also TextArea.RTFDataMBS and WinRTFDataMBS.

Saving is bad enough, but loading text can take forever. Pass 15 K it becomes unusable.

That is where MBS plugins save the day.

Thanks Michel

I use the function, by Massimo Valle, in macosLib (64-bit).

Indeed, it is underneath the same as the plugin.

I prefer plugins, with all the support that come with them.

Yet there are people who cannot afford purchasing the plugin.

Hi Carlo,
Which function is it?

Hi Jacob,
RTFvalue and WriteToRTFDfile, both in Additional Modules > TextAreaExtension.
Something like:
dim o as TextOutputStream
o = TextOutputStream.create(f)
o.Write textArea1.RTFValue
o = nil

Never said it was bad. Just that I prefer plugins.

For a personal use of Xojo, it is quite fine to use declares, even if that means having occasionally to rework the code for system changes.

Professional development is another story. Paying customers won’t admit that the app they bought did not behave as expected because they changed system. The MAS now requires 64 bit apps, and the good ol’ 32 bit declares need updating. I rather spend a bit for plugins than have to dive into declares myself.