Hi,@Scott Q-0525. You could try the following code:
<StackPanel>
<Button Content="show" HorizontalAlignment="Left" Margin="355,60,0,0" VerticalAlignment="Top" Click="Button_Click_1"/>
<RichTextBox Name="myTestRichTextBox" AcceptsReturn="True" Height="100">
<FlowDocument>
<Paragraph>
<Run Text="RichTextBox"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</StackPanel>
string filePath = "C:\\...\\example.rtf";
private void Button_Click_1(object sender, RoutedEventArgs e)
{
TextRange range;
System.IO.FileStream fStream;
range = new TextRange(myTestRichTextBox.Document.ContentStart, myTestRichTextBox.Document.ContentEnd);
fStream = new System.IO.FileStream(filePath, System.IO.FileMode.OpenOrCreate);
range.Load(fStream, System.Windows.DataFormats.Rtf);
fStream.Close();
}
The result:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.