Data from FlowDocument is stored inside the txt file in bytecode:

<Text_rich> e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcdWMxXGh0bWF1dHNwXGRlZmYye1xmb250dGJse1xmMFxmY2hhcnNldDAgVGltZXMgTmV3IFJvbWFuO317XGYyXGZjaGFyc2V0MCBDb25zb2xhczt9fXtcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDI1NVxncmVlbjI1NVxibHVlMjU1O1xyZWQyMjFcZ3JlZW4yMjFcYmx1ZTIyMTt9XGxvY2hcaGljaFxkYmNoXHBhcmRccGxhaW5cbHRycGFyXGl0YXAwe1xsYW5nMTAzM1xmczIwXGYyXGNmMiBcY2YyXHFse1xmMiB7XGx0cmNoIHNoZHNoZ2QxMTF9XGxpMFxyaTBcc2EwXHNiMFxmaTBccWxccGFyfQ0KfQ0KfQ ==

You need to save as plain text "TEXT123". The rest of the document contents (pictures ...) can be left in bytecode. .

public static byte[] FlowDocumennToBlob(FlowDocument document) { MemoryStream stream = new MemoryStream(); TextRange tr = new TextRange(document.ContentStart, document.ContentEnd); tr.Save(stream, DataFormats.Rtf); byte[] blob = stream.ToArray(); stream.Close(); return blob; } public void RichTextBox_(object sender, RoutedEventArgs e) { var blob = FlowDocumennToBlob(text_rich.Document); node.text_rich = new byte[blob.Length]; node.text_rich = blob; } 
  • And why do you create node.text_rich and immediately node.text_rich it? - VladD
  • Well, you save in the format Rtf, you never know what and how it is encoded? Want a human readable format (why ??), save to text. - VladD
  • without creating a new array node.text_rich = new byte[blob.Length]; an error occurs - codename0082016
  • What mistake? I hope you understand that you create an array and immediately overwrite the link to it? - VladD

0