因为每个块都由一个流程文档“拥有”,所以不能将其添加到另一个块中。您必须序列化它,然后反序列化它,这会破坏与原始流程文档的绑定,从而允许您将其添加到另一个流程文档中。
/// <summary>
/// Adds one flowdocument to another.
/// </summary>
/// <param name="from">From.</param>
/// <param name="to">To.</param>
public static void AddDocument(FlowDocument from, FlowDocument to)
{
TextRange range = new TextRange(from.ContentStart, from.ContentEnd);
MemoryStream stream = new MemoryStream();
System.Windows.Markup.XamlWriter.Save(range, stream);
range.Save(stream, DataFormats.XamlPackage);
TextRange range2 = new TextRange(to.ContentEnd, to.ContentEnd);
range2.Load(stream, DataFormats.XamlPackage);
}
复制自:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/f4b26d9b-5b74-446b-85e7-e49e519380ad