We have 2 flowdocuments that we'd like to compare similar to when using a diff viewer (winmerge, beyond compare, etc). Has anybody done this or know how to get the text out of a flowdocument to do a compare?
+1
A:
Here's a way to save it as raw xaml (text file) from the code-behind file, assuming that the flowdocument (not viewer) itself is named "myFlowDoc", if only the viewer is named, use the property .Document of the viewer to get it. And a stream to a 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);
Fred
2008-11-26 13:41:19
A:
Hi, I just forged together a basic WPF diff viewer. Shouldn't be too hard to adapt it to write a side by side Flowdocument diff view.
Find more information here: http://www.eqqon.com/index.php/GitSharp#GitSharp.Demo
-- henon
henon
2010-01-31 00:53:32