1string rtfText; //string to save to db
2TextRange tr = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
3using (MemoryStream ms = new MemoryStream())
4{
5 tr.Save(ms, DataFormats.Rtf);
6 rtfText = Encoding.ASCII.GetString(ms.ToArray());
7}
8
1string rtfText= ... //string from db
2byte[] byteArray = Encoding.ASCII.GetBytes(rtfText);
3using (MemoryStream ms = new MemoryStream(byteArray))
4{
5 TextRange tr = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
6 tr.Load(ms, DataFormats.Rtf);
7}
8