Copy/write StyledText.RTFData to file

RTF is pure text, so it can be saved like any other text content with a TextOutputStream.

https://documentation.xojo.com/api/files/textoutputstream.html#textoutputstream

This slightly modified example writes the Textarea1 styled text RTF Data into a file.

Var f As FolderItem
Var t As TextOutputStream
f = FolderItem.ShowOpenFileDialog(FileTypes1.RTF)
If f <> Nil Then
  t = TextOutputStream.Open(f)
  t.Write(TextField1.StyledText.rtfdata)
  t.Close
End If

@Jean-Yves_Pochez and @Michel_Bujardet

Setting DesktopTextArea as Super, the declares of the module require to be updated/modified. For instance, in the debugger, instead of pointers I’m told to use integers, and so on. But I have not enough knowledge to do such things.
I’ve contacted Massimo Valle (the one who coded it); I hope he will see to it.
As for myself, since I do not use API2 I have no problem.