序列化:
string strDocument = System.Windows.Markup.XamlWriter.Save(m_RichTextBox.Document);
保存成字符串的形式
反序列化:
System.IO.StringReader tStringReader = new System.IO.StringReader((string)e.Value); //其中e.Value是序列化中的string
System.Xml.XmlReader tXmlReader = System.Xml.XmlReader.Create(tStringReader);
FlowDocument tFlowDocument = (FlowDocument)System.Windows.Markup.XamlReader.Load(tXmlReader);