问题
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