TextArea preserve Bullets and Tables

I would like to retain my tables and bullets within my RTF documents. When I paste a note into my textarea, theses features do appear. Once saved, I loose the formatting. Is there something I need to do to preserve these items?

I am loading from my db BLOB field named Note.

TextArea1.StyledText.RTFData = data.Field(“Note”).StringValue

Your advice is appreciated.

Robb

You share the way ypu get the RTF back (TextArea1.StyledText.RTFData = data.Field("Note").StringValue), but not the way you save it.

As you discovers,it is a subset of RTF that Xojo deals with. You have to save the whole RTF, then open it (like you’ve done or in a rtf file).

How do you save the RTF from your TextArea ?

Well, the StyledText.RTFData does not support a lot of styles.
But you can use MBS Plugins instead.

TextArea.RTFDataMBS for example.

[quote=337118:@Christian Schmitz]… you can use MBS Plugins instead.

TextArea.RTFDataMBS for example.[/quote]
Mac only. Why? It seems a major omission to not offer it cross-platform.

Because TextArea.WinRTFDataMBS is for Windows and in a different plugin.

Use BKeeney’s Formatted TextControl and you get the same support x-platform

FTC does not have list and table support.

Thats too bad
But it has consistent x-platform support

About more than a year ago I have gone thru the process of trying to use TextArea limited RTF support, which output of the control (windows version versus mac version) is not equal, as expected.
I did also tried with TextArea.WinRTFDataMBS and TextArea.RTFDataMBS but it did not work either for me since I have mac and windows versions of my desktop application mixed working on the same database and RTF-outputs were still not equal.
Finally I went with HTMLEdit , which is now a part of GraffitiSuite.

[quote=337104:@Emile Schwarz]You share the way ypu get the RTF back (TextArea1.StyledText.RTFData = data.Field("Note").StringValue), but not the way you save it.

As you discovers,it is a subset of RTF that Xojo deals with. You have to save the whole RTF, then open it (like you’ve done or in a rtf file).

How do you save the RTF from your TextArea ?[/quote]

Here is how I save the textarea to my db field.
sql = “UPDATE Notes SET Note = '” +TextArea1.StyledText.RTFData + " ’ where TaskID = "+ str(rec)
//msgbox(sql)
App.db.SQLExecute(sql)

If “NOTE” is defined with an SQLite affinity of TEXT then it may be the issue…
For RTF data I would try using an affinity of BLOB instead

If you want/must use a TEXT affinity, then I would think about using Base64 encoding

[quote=337197:@Dave S]If “NOTE” is defined with an SQLite affinity of TEXT then it may be the issue…
For RTF data I would try using an affinity of BLOB instead

If you want/must use a TEXT affinity, then I would think about using Base64 encoding[/quote]

Note is of type BLOB in Sqlite.

Is there a better way to assign the textarea back to my note in sqlite? I am getting an unrecognized token error.

dim s as string = TextArea1.WinRTFDataMBS(false)
sql = “UPDATE Notes SET Note = '” + s + "’ where TaskID = "+ str(rec)

Use a prepared statement

Thanks, that worked.

Now back to your original question

There is no “cross platform rtf field” like what you want
The closest you get is likely

  1. enabling some native features on each target - which is basically what christians plugins or several declare libraries allow you to do
  2. B’Keeney’s Formatted text control (but it doesn’t support some things like bob noted)
  3. some other data representation type (like HTMLedit which lays out using html)

BUT this still means you are going to have difference between OS X and Windows

The TextArea is NOT cross platform “Word like text editor”