开发者

Keep RichEdit Formatting as a String?

开发者 https://www.devze.com 2023-03-06 06:12 出处:网络
I am assigning a string to a custom type I have declared, which I Read/Write using the TTreeViews Node.Data property. I read and write to and from the node, something like this:

I am assigning a string to a custom type I have declared, which I Read/Write using the TTreeViews Node.Data property. I read and write to and from the node, something like this:

Read: RichEdit1.Lines.Text := TMyData(TreeView1.Selected.Data).MyString;

Write: TMyData(TreeView1.Selected.Data).MyString := RichEdit1.Lines.Text;

This works perfect for plain strings开发者_运维技巧, I want to allow Rich Formatted text to be stored in the string, without losing the formatting. I managed to do this by using Streams on the RichEdit, because I am saving my database using the Freeware Zeos Lib (SQL) I get Unknown Token errors (likely from the RTF tags). How can I save without the errors?

UPDATE

I have managed to get it saving correctly without erroring now, using Base64 Encoding/Decoding as suggested by Sylverdrag. This encodes my strings removing the bad characters.


Check out http://delphi.about.com/od/adptips2003/a/bltip1203_5.htm

(My original answer was for C# - misread your question)

0

精彩评论

暂无评论...
验证码 换一张
取 消