title: How to convert FlowDocument to string?
body: <p><a href="https://i.stack.imgur.com/YHqA3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YHqA3.jpg" alt="enter image description here"></a></p>
  
  <p>1) How to convert FlowDocument to string?</p>
  
  <p>2) How to convert my string to FlowDocument?</p>
  
  <p>FlowDocument contains text and pictures.</p>
  
  <p>The text in the string should be preserved. <code>Text12345</code></p>
  
  <p>Pictures must be converted. For example, encoded: <code>iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABHNCSV</code></p>
  
  <pre><code>Text12345
  iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABHNCSV
  Text67890
  
  
  &lt;text&gt;
      Text12345
      &lt;encoded_image&gt;
          iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABHNCSV
      &lt;/encoded_image&gt;
      Text67890
  &lt;/text&gt;
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;RichTextBox x:Name="textrich" &gt;
      &lt;FlowDocument &gt;
          &lt;Paragraph/&gt;
      &lt;/FlowDocument&gt;
  &lt;/RichTextBox&gt;
  </code></pre>