0
我想将richtextbox文本以C#wpf保存到一个简单的.txt文件中。我的代码:保存richtextbox文本wpf
string RichTextBox1Text = new TextRange(RichTextBox1.Document.ContentStart, RichTextBox1.Document.ContentEnd).Text;
System.Windows.Forms.FolderBrowserDialog FolderPath = new System.Windows.Forms.FolderBrowserDialog();
FolderPath.ShowDialog();
StreamWriter sw = new StreamWriter(FolderPath.SelectedPath + "\\Log.txt");
sw.Write(RichTextBox1Text);
sw.Close();
这并不工作,但如果我的RichTextBox中有文字:
ABC
高清
GHI
将显示为:ABC DEF GHI(在同一行)
我怎样才能像在我的richtextbox中那样分开行呢?谢谢(顺便说一句,这是wpf)!