FlowDocument Xml serialization

北城以北 提交于 2021-01-29 11:10:30

问题


I have FlowDocument as a part of another composite object, what must be serializable.

[Serializable]
public class RichTextSerializationWrapper
{
     public FlowDocument Document { get; set; }
}

So, I want serialize RichTextSerializationWrapper as follows:

var serializer = new XmlSerializer(typeof(RichTextSerializationWrapper));
TextWriter writer = new StreamWriter(fileName);
serializer.Serialize(writer, richTextSerializationWrapper);
writer.Close();

And I, of course, get exception:

There was an error reflecting type 'System.Windows.Documents.FlowDocument'.

So, anybody know ways to serialize FlowDocument object into XML?

Thanks.


回答1:


According to this question: Saving FlowDocument to SQL Server

Binary and XAML serialization are supported.



来源:https://stackoverflow.com/questions/8573739/flowdocument-xml-serialization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!