Are there FlowDocument viewers for WPF?

We have 2 flowdocuments that we would like to compare with them when using a diff viewer (winmerge, without compare, etc.). Does anyone have done this or knows how to get the text from the flowdocument in order to do the comparison?

+1


source to share


2 answers


Here you can save it as a raw xaml (text file) from the code file, assuming the flowdocument itself (not the viewer) is called "myFlowDoc", if only the username is named, use the viewer's .Document property to get it. And stream to stream myStream (FileStream, MemoryStream, etc. Doesn't matter).



// Create a TextRange around the entire document.
TextRange documentTextRange = new TextRange(myFlowDoc.ContentStart, myFlowDoc.ContentEnd);

// Save it. Note that it will not respect current stream position;
//  it'll assume that it gets the entire stream.
documentTextRange.Save(myStream, DataFormats.Xaml);

      

+1


source


I just faked a basic WPF diff viewer. It shouldn't be too hard to adapt it to write a parallel Flowdocument diff view.

Find more information here: http://www.eqqon.com/index.php/GitSharp#GitSharp.Demo



- henon

+1


source







All Articles