开发者_如何学JAVAGiven a rich text editor, I want to save the "rich" text to a database, and load it later.
So how can I get
and set
the rich text?
I looked at the API and there is a property called text
which is only PLAIN text, not what I need. There is another property called textSnapshot
which sounds like maybe thats what I need to use, but its READ-ONLY so I can't set it?
Is there a way to do this?
Thanks!
UPDATE
It turns out I am only going to save it from a RichTextEditor
, and I need to set it has htmlText
on a Text
control,
so is there a way to get the rich text and convert it to hmtlText?
I'm not sure what you mean by rich text. The htmlText
holds all the informations which the components use for rendering the HTML text, and which is also the base of the RichTextEditor
rendering. You can get and set it, and that's exactly what you need to store in the DB and put the text back after retrieving it. There's no export it as rtf out of the component. It's rich in the sense that it's more than a simple textInput :)
精彩评论