Export FlowDocument with UIElement to rtf
问题 I am trying to export a FlowDocument which contains a grid to rtf. I used the following code using (FileStream fs = new FileStream(@"C:\demo.rtf", FileMode.OpenOrCreate, FileAccess.Write)) { TextRange textRange = new TextRange(doc.ContentStart, doc.ContentEnd); textRange.Save(fs, DataFormats.Rtf); } However I am getting a blank document. How can this be solved? 回答1: I had a similar issue recently and the culprit turned out to be the FileMode.OpenOrCreate It should have been FileMode.Create